when does dalvik unload shared library

Showing 1-5 of 5 messages
when does dalvik unload shared library simon....@hotmail.com 2/26/12 7:36 PM
this is really puzzle me lately moment.
I'm writing a application, and part of it use ndk. there is some
function may use native thread to download file.

I want to the download thread keep run even if the application has
called onDestroy(), but will the dalvik unload the shared library at
same time? If so, I think my application stop download task at same
time.

I look up in the android-ndk groups and find this article:
http://groups.google.com/group/android-ndk/browse_thread/thread/b1fe7ac5523249f2

where fadden says the shared library is never unloaded. but here I get
a puzzle, if the shared library is never unloaded, then if I load a
lot of shared libraries. will the system goes to a memory shortage?
how dalvik manage these shared libraries when a Activity ends its
lifecycle? Can anyone illustrate it for me?
Re: when does dalvik unload shared library simon....@hotmail.com 2/28/12 1:55 AM


On 2月27日, 上午11时36分, "simon.zhu....@hotmail.com"
<simon.zhu....@hotmail.com> wrote:
> this is really puzzle me lately moment.
> I'm writing a application, and part of it use ndk. there is some
> function may use native thread to download file.
>
> I want to the download thread keep run even if the application has
> called onDestroy(), but will the dalvik unload the shared library at
> same time? If so, I think my application stop download task at same
> time.
>
> I look up in the android-ndk groups and find this article:http://groups.google.com/group/android-ndk/browse_thread/thread/b1fe7...
>
> where fadden says the shared library is never unloaded. but here I get
> a puzzle, if the shared library is never unloaded, then if I load a
> lot of shared libraries. will the system goes to a memory shortage?
> how dalvik manage these shared libraries when a Activity ends its
> lifecycle? Can anyone illustrate it for me?


Is there anyone can help me?
Re: when does dalvik unload shared library nasif 2/28/12 3:45 AM
 
Dont worry about number of shared library you are loading into the memory. You can load whatever number of library in to memory. Since library is loading in to the stack memory of ram not in heap memory of process, when they process is no longer using os will remove the libs
 
When you are agian launching application os will load the lib if it not present for the same process. I load up to 5 shared lib at same time
 
Thanks
 
Nasif
2012/2/28 simon....@hotmail.com <simon....@hotmail.com>

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Re: when does dalvik unload shared library Tor Lillqvist 2/28/12 8:44 AM
Dont worry about number of shared library you are loading into the memory. You can load whatever number of library in to memory.

Actually, on Android, you can't.  At least not if you use the system's dynamic linker (dlopen()): http://androidxref.com/source/xref/bionic/linker/linker.c#55

Yes, most people probably would say 128 "should be enough for anybody".

--tml

Re: when does dalvik unload shared library Stephen Williams 2/28/12 9:16 AM
Could be changed in future versions of dllib, or you could include your own modified dllib (bad if compatibility changes...).

sdw


--tml