harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Varlamov <alexey.v.varla...@gmail.com>
Subject Re: harmony vm as a lib
Date Tue, 05 Jan 2010 10:28:38 GMT
2010/1/4 Regis <xu.regis@gmail.com>:
> On 2010-01-04 12:55, Tim Prepscius wrote:
>>
>> That was the plan.  I am linking hyluni as a static already.  I think
>> there is some additional initialization I must do somewhere.
>> But at this point, I'm more concerned with the 33 megabytes being used
>> for just a partial initialization.
>>
>>
>> If these 33 megabytes are coming because somewhere something is
>> allocating 32 megabytes reserve heap, and then is going to
>> sub-allocate that for java objects, then I can probably modify this
>> behavior somehow to allocate as needed.  But if 33 megabytes are being
>> allocated for java initializations-  then it would take a whole lot of
>> work before I can use harmony.
>>
>> It's really hard for me to believe that 33 megabytes are coming from
>> loaded classes.  I'll investigate more this week.  Hmm.. Maybe the
>> garbage collector needs to be invoked or something?
>
> IIRC, the java heap is about 4MB for simple HelloWorld, I guess the most of
> memory is consumed by vm, not classlib.
I guess most of those 33M are reserved by GC. Quick browsing shows
(working_vm\vm\gc_gen\src\common\gc_options.cpp) that by default
gc_gen sets min heap size as 1/10 of the default max heap which is
256M. Plus there are a bunch of various pools (vtables, jitted code,
classloaders, interned strings etc) pre-allocated by VM. Historically,
the DRLVM was mostly server-oriented so the default settings (size of
pools in particular) seem to be overkill for your purposes.

>>
>> Does anyone know what the minimum memory usage is for an initialized
>> jvm before executing client code.. meaning after all of the necessary
>> initialization classes are loaded, but before any client app dependent
>> classes are loaded, etc etc etc etc?
>
> Will some profiling tools like Valgrind or strace can help to figure out who
> allocate the largest memory blocks?
Trace logs might help as well, drlvm has decent support of built-in
debug logging. It is enabled with -Xtrace option in debug build (run
with -X to get more details).

>>
>> Currently the libraries I'm linking statically are:
>> apr-1.lib, ch.lib, em.lib, encoder.lib, harmonyvm.lib, hycommon.lib,
>> hyprt.lib, hythr.lib, hyzip.lib, icuuc34d.lib, interpreter.lib,
>> port.lib, verifier.lib, vmi.lib, zlib.lib, hyluni.lib,
>> gc_gen_uncomp.lib

AFAIR the icuuc is the best next candidate for ablation. It is quite
massive but useful mostly for exotic cases like fancy unicode strings
in classfile constant pools.

>>
>> I'm doing the static JNI initialization via a table I'm adding to by
>> hand.. I was hoping to add the minimal set needed for initialization
>> and things I wanted to support, and then tell the linker to remove
>> dead code, and see what it removed.
>>
Sorry for the dumb question, did you fix the classlib build to produce
static libs? I've seen you concentrated on the vm so far.

>>
>> Happy New Year!!!

Thanks, and all the best wishes to you too!

--
Alexey

Mime
View raw message