PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Heap integrity checking

I'd guess this would be a frequent question, but apparently I was unable to find the correct keywords.

I am currently setting up all the official conformance tests for my little OpenGL library, and I am getting access violations (and similar exceptions) in malloc while executing the coverage tests. My guess would be that the heap structure gets corrupted due to writing beyond a memory block boundary or something fairly similar...

Anyway, both desktop VC++ as most *nixes have convenient debugging versions of the heap libraries that help significantly in tracking down these issues. VC++ 4.0, however, seems to be based off an older version of the heap libraries (obviously the reason why it crashes instead of giving a nice debug message).

Hence, is anybody in this forum aware of a useful debug library/tool that can assist in tracking down these type of issues? I could, of course, try to port the desktop version to pocket pc, but maybe there is a simpler solution...

Any suggestions?

Any help is highly appreciated,
HM
It's a shot in the dark (not got time to answer this myself right now):

Could this be compiled/patched for PocketPC?

<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=69e7fb1b-1fbe-4e86-b905-74b5473499b3&displaylang;=en">Visual C++ 6.0 Sample PageHeap1.exe Finds Heap Corruption and Memory Errors</a>

(Couldn't try because my eVC++ install here at work seems to have lost all of its devices :evil: ).
Digby wrote:http://www.entrek.com/

Looks exactly like what I've been looking for... thanks a lot. Have you tried it yourself before?

- HM
put wrappers around all memory functions, this allow you to do your own memory management, debugging, error, leak checking...thats the way I normally do this stuff, write it once and you can use it on different platforms rather than being reliant on third party tools :)

Jim.
Hence, is anybody in this forum aware of a useful debug library/tool that can assist in tracking down these type of issues?


Compuware BoundsChecker can help you with this. it detects wrong parameters passed to system functions, out-of-bound array accesses and a lot more...
unfortunately there is no PPC version (as far as i know).

bye,
Daniel
drgoldie wrote:Compuware BoundsChecker can help you with this. it detects wrong parameters passed to system functions, out-of-bound array accesses and a lot more...
unfortunately there is no PPC version (as far as i know).
I know, that's what I've been using on the PC (giving up all home-grown libraries...). I downloaded the entrek eval, and the tool looked pretty good. Didn't help me find the issue though, but was a good check that there was no other issue left.

BTW, the actual problem was a (bug/issue) in VC++ 4.0 (I haven't checked if it is documented behavior): I had two instances of a template function template<class PixelType> CopyPixels(blah)

and I was using the explicit template instantiation syntax

CopyPixels<U8>(...) and
CopyPixels<16>(...)

However, even for CopyPixels<U8>(...) the compiler generated code calling into the 16-bit version (thus copying twice as much of memory).

Anyway, I changed the code to use the syntax employed in early STL implementations, where a fake unused argument is appended to the argument list to determine which instance of the template is to be used.

- HM