Kiev & out-of-memory

Maxim Kizub max at
Tue Dec 8 16:08:18 PST 1998


I've downloaded beta3. Kiev works now! At least,
it can compile itself (but generates wrong code - there should be
some bugs in java libraries - I'll check this out).
(Godmar, looks like you got old kiev008_g.jar - there is no
the error you've reported with my distrib. I remember, I did some
enhanchments in kiev.stdlib.Debug class, and they, may be,
reflected only in new files - there are special bug-fixed jars
on download page).

Now, about $subj.


Results of running "kaffe kiev.Main ..." :
total 1196617ms, max memory used = 56320 Kb

Results of running "java kiev.Main ..." (with TYA 1.0 jit) :
total 634607ms, max memory used = 7918 Kb

I.e. 56 Mb memory usage to compare with 8 Mb :-(
The compilation time difference may be coused by the memory, thus
significantly more work for GC.

There may be two reasons for such enormouse memory requirements:
1) Kaffe uses unoptimized allocation strategy
2) Kaffe does not properly collect the garbage.

First, Sun's java Object itself allocates not more then 12 bytes (plus some
bits - for GC/syncronization, possibly). I did this test sometimes. Also,
I know that those 3 words are a) pointer in the handler table to actual
b) pointer in the handler table to virtual table of methods, c) header
of object's data (I think - pointer to class structure of this object).
Shure, pointer to VT is not required, but, looks like it greatly speedups
method calls, and Sun decided to spend this 4 bytes ;-)
So, can you explain the memory usage of kaffe objects? If it does not
differ a lot (eight times difference for my compiler!) - the the problem
in GC.

About GC. As I did explain in previous messages, kiev is two-pass
compiler. Memory carefully freed after each file parsing. And memory
structure is (huge) AST tree - so, any error in GC near the root oof tree
may prevent collecting the memory :-( So, this is the most possible
way to get those 56Mb... i.e., maybe, sometimes, memory cannot be
collected... Well, I don't know. Please, how can we check this out?

  Maxim Kizub

More information about the kaffe mailing list