Strange native leak - OutOfMemory after language change.

by Pedro Oliveira » Tue, 25 Jan 2011 02:51:09 GMT

Sponsored Links

I am facing a strange native memory leak in my application, can
someone help me please?

The leak heppens after change the language of the phone in settings.
Before changing the language, I have just opened the application and
ran dumpsys meminfo in the process. The result was that the process
had 18495 KB total memory allocated, which were 11704 KB native and
6791 KB dalvik.

After changin language for the first time, opening the app again and
running dumpsys meminfo onge more time, the result was that the
process had 24115 KB total memory allocated, which were 17324 KB
native and 6791 KB dalvik.

Looking the heap size in DDMS I saw the process had a total of 6 MB,
which makes sense with the 6791KB of dalvik memory allocated. Changing
the language again makes the total allocated memory grow, getting to
29335 total memory allocated, which were 22544 KB native and 6791 KB

As you can see, it is only the native part that grows, therefore using
Eclipse MAT on the generated HPROF file does not give any good leak

We are passing the application context instead of the activity context
as explained in the article 

I compared the results with other applications in the phone, and saw
that it is common to the memory allocated to grow in the first time
the language is changed, but the amount of memory is kept unchanged in
the subsequent changes for those other applications.

I also read that "DDMS does not report memory that is allocated on
your behalf on the native side", but than, how can I make sure that
memory will be freed? Also, the content of the native memory must be
connected to the dalvik amount of memory, how can I find that

I am getting out of ideas, did anyone see something similar or have
any hints for me?

Thanks in advance!!


Other Threads

1. Android XML Schema Location


The Android XML Schema is declared in the xml files as being at
"". Since this URL is not
found, how does Android validate the xml attributes that are in the
Android namespace? I am guessing the schema file comes bundled with
the SDK, in which case where is it located?

Thank you,
Mihai Fonoage


2. is there a way to simulate a dropped connection in the emulator?

maybe more importantly going out of range.

specifically going out of data range (not voice).  i.e. i'm browsing
for something and I go out of range.

or to control the speed of the connection?


3. Do you miss Calendar search?

4. How to rotate a drawable programmatically?

5. REGRESSION - trap in android 1.6 SDK inflating DialogPreference from XML

6. Developing barcode Application

7. surfaceflinger & compiz