I have an application that I've been working on the past few months that uses a lot of dynamic data. Before exiting, I would like to check for memory that I forgot to GlobalFree.
Posted on 2002-09-05 19:01:33 by eet_1024
I'd go for a linked list containing diff. memory pointers.
struct allocmem{

lpMem DD ?
....
lpNext DD ?
}
lpMem contains pointers to the allocated memory .... lpNext to start chaining these pointers.

When the app exits, all you have to do is to start at the first entry, deallocating that pointer in memory(lpMem) then continue until the end. When all is done deallocate the linked list. :) I'm sure you undertood me right?
Posted on 2002-09-05 22:06:20 by stryker
So InitArray ( one of my procs ), Push_A(, ect ) each GPTR that I Alloc, and then Pop_A( Yet another proc that returns the GPTR) untill GOD knows what happens.

Win32 API does not provide any API that states my App is a reasource Hog?

p.s. I've GlobalAlloc an block that contains PTRs to GlobalAllocs -- I'm hopeful that I'll be abel to release the source when I'm done.
Posted on 2002-09-06 01:59:10 by eet_1024
Dont forget (even if its not the best method) that windows will automactically deallocate any memory Allocated when your process exits.
Posted on 2002-09-06 04:58:12 by huh
eet_1024,

Its not a big deal if you write both allocation AND deallocation code at the same time. The technique that Josh mentioned will do the job fine but you can also manually do the allocations and deallocations.

Its worth having a good look at the different memory allocation strategies that are available as the granularity of some is different to others and you may be able to tailor the usage more accurately.

Regards,

hutch@movsd.com
Posted on 2002-09-06 05:05:56 by hutch--