This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

IdentityHashMap & natStackTrace


Hi,

I'm using gcc version 4.0.0 20041113 (experimental).

In StackTrace.java/natStackTrace.cc(update()) an IdentityHashMap is
used to store all methods.

IdentityHashMap.java:

emptyslot = new Object();

public Object put(Object key, Object value)
       ...
       if (size > threshold) {
          table = new Object[old.length << 1 + 2];
          Arrays.fill(table, emptyslot);
       ...
       }
       ...
       
I suppose I have a lot of classes/methods in my app, and once it
crosses a certain threshold, this map ballons from 21,504 to 172,032
entries in one expansion. This seems excessive. Sun's java simply
doubles the size AFAIK.

This implementation fills the array with emptyslot (Arrays.fill),
which uses a whole bunch of memory. Can't a guard be used on lookups
instead of actually filling this in (checking equality with
emptyslot)?

These two issues seem to be a burden on the heap.  I can drop ~400k of
ram by doubling the size of this instead of using "old.length << 1 +
2" during each table expansion.

Regards,
Rutger Ovidius




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]