On Mar 29, 11:26 am, devi prasad <[email protected]> wrote:
> I notice that gDvm.heapSizeMax gets passed (directly or indirectly) to
> the rest of the vm code.
> Also, are the comments mentioned in the code true? Can we avoid the
> default limit by passing larger values to the said arguments?

You can, if you can pass the arguments.  The VM is embedded in the
Android runtime, not launched on the command line.

What you're really looking for is in frameworks/base/core/jni/
AndroidRuntime.cpp; search for CUSTOM_RUNTIME_HEAP_MAX to see where
somebody else has already done an override at compile time.  Note the
heap max is passed in through "-Xmx".

The part where this gets tricky is that the VM is only initialized
once; all subsequent instances of the VM are the result of a fork()
with no exec().  Once the VM has been initialized you can't change the
heap max, because some data structures are sized to match.  Giving one
app a larger virtual heap is most easily accomplished by giving
everybody a larger heap and then forcing most of them to make do with
less than the actual maximum.  The less-easy but better approach would
be to resize the various heap structures, which is a bit awkward but
probably doable since there's only thread running at that point where
the zygote forks.

You can also fork+exec the new process, but now you're losing the size
and startup time advantages that the zygote provides.

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

Reply via email to