stack overflow error

Hey guys

Can someone identify why i am getting a stack over flow error, even though i set the stack reserve size to 10mb still.

it worked for a while and then it got stack overflow.

the code can be found below


header file

would appreciate if you guys could help
It would help if you pointed out where it was crashing.

Did you mean to pass those matices/vectors by value?
It crashes before it even starts executing anything in main, no matter where i place a break point it crashes before it even reaches the break point.

yes, i meant to pass them by value.
unless if passing by reference would work how would i change it to do that.
It crashes before it even starts executing anything in main.
You don't really have any globals that run constructors that do significant amounts of work, so it sounds like a build problem rather than a programming problem.

An alternative to pass by value on this example:
Scalar meanpixel(Mat matrx)
is to pass by const reference. It looks like this:
Scalar meanpixel(const Mat& matrx)
And yes, you should be using it.
i should do this with all where i define a function which require a matrix i should change it to const Mat& matrixname

and when calling the function i woul do


i don't think i use scalar mean pixel but still will change it as well as others the same way.


EDIT:So the stack overflow error cannot be solved then
i changed it to pass by const reference and still getting the error.

I changed only the matrices that do not change in the function.

but, still error.

any help or is it something to do with visual studio bug
Last edited on
so i decided to reduce the size of the 3d array to 60 and no more stack over flow error

but it now comes error to when i used pass by const reference
Assertion failed (!fixedSize() || ((Mat*)obj)->size.operator()()==_sz) in unknow function, file .... matrix.cpp, line 1313.

so i will leave it as pass by value

Topic archived. No new replies allowed.