views:

318

answers:

2

I know this might be an oversimplification - but I need to know the amount of free memory I could allocate in my program. It's a windows mobile project (c++) and it seems like I might have a memory leak hiding somewhere. Calling a function which returns the remaining size (or remaining chunks) of heap storage I could access would be perfect. Is there some way to traverse the available chunks of memory the operator new uses? Or a built-in WINAPI (or winmobile) function that does it?

A: 

Have you checked out The CLRProfiler for the .Net Compact Framework?

It's part of the Power Toys for .NET Compact Framework 3.5 download.

Getting Started Video Tutorial: How Do I: Use the CLR Profiler to Detect Finalization Problems On My Device?

Mitch Wheat
Tried it now, thanks for the suggestion.The problem is that my program crashes after a certain amount of memory allocations, so I'd like to run in debug mode from VS and to check the heap size before it crashes.Also, for some reason, the "kill application" button has no effect and I don't get any statistics after the crash
frust99
+1  A: 

Check out GlobalMemoryStatus. It will provide the amount of free physical memory. Note that older Windows CE enforce 32MB per process limit (Windows CE 6.0 lifts this limit).

avakar