On Jul 24, 8:16 am, Mercury <[email protected]> wrote:
> For memPartAlloc message, I think that maybe when Dalvik exits, it did
> not free memory so it leads to leak memory and so if we invoke to run
> several times, it cannot get enough memory to allocate for heap size
> and cannot start again. So I think that with heap size only 4MB and if
> I invoke my simple test app many times , maybe Dalvik will be crashed
> too ( with 32MB heap size, it crashed at 3rd time running).

Dalvik is pretty good about freeing memory allocated with malloc().  I
use valgrind to find memory leaks, and it's much easier to do so if
you free everything you allocate.

I glanced through the virtual heap code and it looks like it does try
to clean up after itself during shutdown, but I haven't tried to
verify it.

In normal operation, Android application processes do not exit.  They
are simply killed.  If the operating system doesn't clean up after
them, you're going to be in a bad way if you try to run the full app
framework.

Incidentally, you definitely need to use calloc rather than malloc as
an mmap() replacement.  Storage from ashmem or anonymous mappings is
zeroed out.

Is it really the case that memory allocated with malloc() on a vxworks
system is gone forever if the process dies?

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to