This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
IdentityHashMap & natStackTrace
- From: Rutger Ovidius <r_ovidius at eml dot cc>
- To: java at gcc dot gnu dot org
- Date: Thu, 25 Nov 2004 11:19:06 -0800
- Subject: IdentityHashMap & natStackTrace
- Reply-to: Rutger Ovidius <r_ovidius at eml dot cc>
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