Strange native leak - OutOfMemory after language change.

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


Sponsored Links
 Hi.

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
dalvik.

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
suspects.

We are passing the application context instead of the activity context
as explained in the article 
 http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html 

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
connection??

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

Thanks in advance!!
Cheers!!
Pedro

-- 



Other Threads

1. Which factor decide resource in folder 320x240 be used.

Hi,

When I create a 120dpi emulator, it is found the the resource in
320x240(for example drawable-320x240) folder can't be read.

I read the document
http://developer.android.com/intl/zh-CN/guide/topics/resources/resources-i18n.html#AlternateResources

Screen pixel density
Screen dimensions
are different.

If ro.sf.lcd_density=120 decide the resource in drawable-120dpi folder
been used,
Which factor let drawable-320x240 folder be used.

Thanks
gan

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. insert large volume data into sql database

hi all,

I have a large volume data that must insert into sql,
the tables contains about ten columns and at least one thousand rows,
the values of each rows are "string" and different,
so is there a conveniance way to insert String data?
I think the for loop is not a good method to solve...
because it's all the different String data..


thanks!
--~--~---------~--~----~------------~-------~--~----~

3. Sharing a Story

4. android-x86 compile errors

5. Showing force close / report dialog

6. 绛斿: Ongoing...

7. Anyone else notice that the "Top" apps in android.market.com seem inaccurate?