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:
http://msdn.microsoft.com/en-us/library/aa934674.aspx
http://msdn.microsoft.com/en-us/library/aa446904.aspx

LMemDebug
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).

Codesnitch
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:
http://www.entrek.com/codesnitch.html

Have fun!

3 comments:

boottrax said...

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

saurabh said...

Thanks your blog is awesome.
recharge offers
Videocon Telecom, the next-generation GSM mobile service network is the telecom arm of the $10 billion Videocon Group. The company has partnered with global technology leaders to create a robust infrastructure featuring future ready mobile technologies. Powered by the most advanced GSM-EDGE network, Videocon Telecom aims to redefine the Indian mobile telecommunications industry by leveraging a combination of the parent company’s strong brand recall and retail reach with a spirit of innovation and customer centricity. Videocon endeavours to transform the life of every Indian consumer by changing the very paradigm of the way he or she communicates.

roney ahmed said...

نحن نتمرد دائما على واقع عالم نقل عفش بالمدينه المنوره حتى صرنا ان لقبنا افضل شركة نقل عفش بالمدينة المنورة هل تتفاجئ من حديثنا
شركة نقل عفش بالمدينة المنورة
هذا لك الحق ولكن لكل نقل عفش بالمدينة المنورة صفاتها وافكارها كلما زادت نقل العفش بالمدينة المنورة عليك ان لاتتسرع حيث ان التسرع
شركه نقل عفش بالمدينه المنوره
سياتى بالندم على سرقة الاثاث او ضياع للمتلكات الشخصيه التى ربما تكون غاليه عندك ولا تقدر بثمن اذا نرجع للبداية نقوم بخطوات مدروسه فى عمليات نقل عفش المدينة المنورة على سلالم متحركه من التفكير فى كيفية نقل الاثاث من الاماكن البعيده بسيارات مجهزه للسفر الطويل ادوات لتغليف الاثاث ونجارين ذات مهاره خاصه لفك الاثاث وتغليف العفش من البدايه حتى النهايه
افضل شركة نقل عفش بالمدينة المنورة
هم قادرون ويعرفون كل شئ عن ماهية تغليف وفك وتركيب الاثاث.