_CrtCheckMemory before and after function return
following code:
_CrtCheckMemory();
vector<Vector3> samples = Po开发者_Go百科issonDisk::generate_poisson(m_resX-1, m_resY-1, minDist, 30, m_samples);
_CrtCheckMemory();
int s = samples.size();
the debugger traps into the heapcheck function in the second _CrtCheckMemory() telling me there's something wrong with the heap - so my assumption is that my generate_poisson function is doing a mess. however - if i add a _CrtCheckMemory(); call directly at the end of the generate_poisson function, right before return, then the debugger still traps on the same line as before, not on the newly added _CrtCheckMemory()
what could this mean?
thanks!
//edit: could it be possible that another thread is messing up the heap, or does _CrtCheckMemory() only check the heap of the current thread?
Could mean your "Vector3" class is the real mess. Check its constructor.
- Check the copy constructor of Vector3
- What is the return type of generate_poisson? If it is returning a reference to a local variable, bad things will happen.
- Yes, it could be that another thread is messing up the heap (the heap is not per-thread), but I would not expect that to be deterministic (unless you release a mutex which allows a higher priority thread to run).
Or in the PoissonDisk::generate_poisson function something has been deleted when the scope changed( function ends ).
精彩评论