SparkyNZ
SparkyNZ

Reputation: 6676

Detecting Heap Corruption in Android NDK app

When I write C++ with MS Visual Studio, I use the following statement to check my heap for corruptions. This has been an excellent tool in homing in on problems:

_ASSERTE( _CrtCheckMemory() );

Basically you can scatter the above statement around your code to check the consistency of the heap.

Is there something similar that can be used in Android NDK programs to identify heap corruption at runtime - before I crash with a tombstone dump?

Upvotes: 1

Views: 883

Answers (1)

Van der Deken
Van der Deken

Reputation: 166

In Linux, similar functionality can be achieved by mcheck. But, unfortunately, this can't be used on Android (however, here and here can be find mcheck.h for Android)

If your device rooted, you can try this:

For dump analyzation, you can try use deprecated Android Monitor (this link should help to enable native heap dump)

Upvotes: 1

Related Questions