I am monitoring memory of a running app that is doing some complex computations with lots of allocations and then logging results to disk. I am finding that after every computation cycle the amount of available memory (shown via ::GlobalMemoryStatus() call) is dropping by 196608 bytes. at first this seemed to be just a random large amount, but in hex it is precisely 0x30000 and it has me wondering that what might be hapening is that as results are written to disk there might be some fixed allocation adjustments made between what is allocated to Storage and what is allocated to program memory. does anyone know if that is possible?
Also, does anyone know about the details of memory managements under CE - is there some sort of fixed allocation block sizes? The same codebase runs side-by-side on the desktop without this memory leak.
Are there any more advanced memory diagnostics that anyone knows about that I could link in to my app (or run alongside) that would show detailed memory usage, perhaps on a .dll-by-.dll bases (our app has 24 .dll's) so that I could help locate the .dll that is causing the leak?
Have you looked at Entrek Codesnitch? It's a pretty valuable tool for finding leaks and often finds them in just a few minutes. It is odd that the code doesn't have any issue on the desktop.
CE's memory management is pretty well documented in MSDN, though finding the docs can be challenging. The numbers that are typical red flags under CE are 0x1000 (4096 == 1 page which is the minimum physical allocation) and 0x100000 (65536 which is the minimum granularity of VirtualAlloc). All heaps grow in increments of 64k, commits happen in 4k increments. The size you're seeing I would suspect as some artifact of your own code - some magic number being used for allocations.