Thursday, 5 February 2009

How to find memory leaks under Windows CE?

Hello guys,

one of the well-known problems of C++ application developers is, they leak! :(
Memory leaks are deadly and finding them under Windows CE is not easy, avoiding them is the best alternative! :)
But, just in case you have a C++ "leaking" application and you want to find the problem. You will be looking for a tool, which will help you to detect the problem. In this post I would like to give a short introduction to the most popular tools:

Application Verifier
The Application Verifier tool can detect and pinpoint memory leaks, handle leaks (such as critical sections and DLLs), and leaks in graphics device interface (GDI) objects. The tool can also detect some forms of heap corruption.
Application Verifier attaches to an application or DLL and performs tests at runtime. If you want more information about Application Verifier, just look at:

LMemDebug records all the heap operations (plus callstacks) into memory. It discards callstacks for freed allocations, so that you only track callstacks for apparent leaks. It can also give you heap statistics like total allocation counts and list of recent allocations. It is controlled entirely from the Target Control Window --> KITL is required. The output is not really "comfortable" and some documentation stuff is located under: %_WINCEROOT%\public\common\oak\drivers\lmemdebug\lmemdebug.txt. But it is very useful for memory investigations in the OS environment (e.g. leaking drivers).

One of my favorites! It is a code analysis tool from Entrek for Windows CE memory investigations and detecting of common code problems such as memory leaks, resource leaks, invalid parameters and more. The latest release in January 2009 supports also Windows CE 6.0 and Windows Mobile. This tool is very useful for memory investigations at the application layer. More detailed information is availble here:

Have fun!

1 comment:

boottrax said...

Lmemdebug is not used on Windows CE 6.0. It's legacy from CE 5.0