I worked on a bunch of image processing programs. Nothing unusual, mostly experimenting quickly and dirty. Image data is stored in vectors declared on the stack (I try to avoid using pointers when I don't need to pass data). I noticed that some of my functions behave very strange, despite the myriad of debugging and stepping. Sometimes the debugger gave me an error, which, in particular, could not evaluate a certain variable. Things, as a rule, simply do not make sense, and past experience tells me that when this happens, it means that there is some kind of memory overflow or corruption. The first thing that came to mind was that it was probably due to the fact that I stored a lot of image data in vectors.
However, I got the impression that the vectors store their actual data on the heap, and so I thought it would not hurt to have several of these large vectors on the stack. Am I really wrong about that? Should I allocate my vectors and store them on the heap, and not on the stack?
Thank,
source
share