jaysun
jaysun

Reputation: 159

GC_FOR_MALLOC Freed Error, How to Avoid this?

I am making a quiz application, when the user selects a category (eg C#), 20 questions from that category will appear one by one.

Coding is mostly done. When i was testing, the First two attempts worked correctly. After then I started getting these errors (I know it's freeing the memory):

 GC_FOR_MALLOC freed 4136 objects / 374744 bytes in 66ms
 GC_FOR_MALLOC freed 2345 objects / 374744 bytes in 51ms
 GC_FOR_MALLOC freed 3453 objects / 374744 bytes in 62ms
 GC_FOR_MALLOC freed 1245 objects / 374744 bytes in 26ms
 GC_FOR_MALLOC freed 9893 objects / 374744 bytes in 86ms

I tried restarting eclipse, cleaned the project, restarted the emulator, cleared the dalvik-cache of my app. Nothing worked after this, even logcat isn't logging anything.

How do i find the culprit for this? I have never created this many objects, but GC_FOR_MALLOC is freeing them.

Can anyone suggest good practices to avoid these kind of errors in future?

Upvotes: 1

Views: 883

Answers (1)

Darth Beleg
Darth Beleg

Reputation: 2667

You can use Allocation Tracker of the DDMS/ADT to find out what kind of objects are created and what routines are responsible for this. The Tracker shows all allocated objects with the stack traces of the allocation points.

Upvotes: 1

Related Questions