This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 51504 - MDR infrastructure keeps number of similar long Strings for btree file names
Summary: MDR infrastructure keeps number of similar long Strings for btree file names
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P4 blocker (vote)
Assignee: Martin Matula
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2004-11-15 09:47 UTC by Petr Nejedly
Modified: 2006-03-24 09:41 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Nejedly 2004-11-15 09:47:32 UTC
These are full paths to all the btree files.
Issues:
*) 5-8 very long strings per a classpath root: 1-2
instances of base name, .btx, .btd, .btb
*) All of them have tons of trailing space
(generated by StringBuffer)
*) High redundancy (each group of them differ only
in suffix if they differ at all)

The strings consumed ~2.5KB per CP, which may seem
little, but with 100 projects
with >3 CP roots, it accounted for >700KB, that is
2% of used heap.
I suggest to:
-) Not keep the Strings if not absolutely
necessary (e.g. FileCache.fileNames is not really
needed)
-) Keep only the base String and create the file
name as needed (e.g. LogFile, ClassIndex)
-) Have the base name optimized - no trailing space!
-) Find out why two instances of base name get
allocated and eliminate second allocation.

I can provide reference chains for those strings
if needed.
Comment 1 Martin Matula 2004-11-15 10:01:05 UTC
The reference chains would be very helpful. Thanks in advance!
Comment 2 Petr Nejedly 2004-11-22 16:15:53 UTC
References to MDR file names (for one randomly picked database):

org.netbeans.mdr.storagemodel.MdrStorage.instances->
java.util.Hashtable@73f->
[Ljava.util.Hashtable$Entry;@205b->
java.util.Hashtable$Entry@3e34->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.BtreeStorage@803e->
java.lang.String@f0d9->
[C@1e144 ("...base")

org.netbeans.mdr.persistence.btreeimpl.btreestorage.FileCache.pages->
java.util.ArrayList@b7e->
[Ljava.lang.Object;@25e4->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.CachedPage@46aa->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.FileCache@8bc3->
[Ljava.lang.String;@13e31->
java.lang.String@254a5->
[C@370a7 ("...base.btd")

org.netbeans.mdr.persistence.btreeimpl.btreestorage.FileCache.pages->
java.util.ArrayList@b7e->
[Ljava.lang.Object;@25e4->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.CachedPage@46aa->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.FileCache@8bc3->
[Ljava.lang.String;@13e31->
java.lang.String@254a6->
[C@370a8 ("...base.btx")

org.netbeans.mdr.persistence.btreeimpl.btreestorage.FileCache.pages->
java.util.ArrayList@b7e->
[Ljava.lang.Object;@25e4->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.CachedPage@46aa->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.FileCache@8bc3->
org.netbeans.mdr.persistence.btreeimpl.btreestorage.LogFile@13e35->
java.lang.String@254a9->
[C@370ab ("...base.btb")

org.netbeans.modules.javacore.ClassIndex.codebaseIndexes->
java.util.Collections$SynchronizedMap@fcb->
java.util.HashMap@2b0e->
[Ljava.util.HashMap$Entry;@5436->
java.util.HashMap$Entry@bcb8->
java.util.HashMap$Entry@19111->
java.util.HashMap$Entry@2a351->
java.util.HashMap$Entry@3bd39->
org.netbeans.modules.javacore.ClassIndex@53692->
java.lang.String@74674->
[C@9940e ("...base", another copy)

5 long strings, all with common prefix, all trailed by wast amount of
empty space from StringBuffer creation.
Comment 3 Martin Matula 2005-02-21 14:39:20 UTC
Fixed. Now only the single "base" name should be kept.

Checking in
src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/BtreeDatabase.java;
/cvs/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/BtreeDatabase.java,v
 <--  BtreeDatabase.java
new revision: 1.29; previous revision: 1.28
done
Checking in
src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/FileCache.java;
/cvs/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/FileCache.java,v
 <--  FileCache.java
new revision: 1.6; previous revision: 1.5
done
Checking in src/org/netbeans/modules/javacore/JMManager.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/JMManager.java,v
 <--  JMManager.java
new revision: 1.95; previous revision: 1.94
done
Comment 4 Petr Nejedly 2005-02-22 09:38:49 UTC
Seems mostly fixed.
I've found only one instance of each basename (with no trailing space),
but also one instance of each .btb variant referenced from LogFile
instances although the databases should not be modified (no actual
RandomAccessFile instance, no actual .btb file on the disk).

I'm reopening this with reduced priority as the impact of the better
fix will be smaller. Feel free to close it again if it would be too
complicated to improve.
Comment 5 Martin Matula 2005-02-22 13:46:58 UTC
Hopefully fixed.

Checking in
src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/BtreeDatabase.java;
/cvs/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/BtreeDatabase.java,v
 <--  BtreeDatabase.java
new revision: 1.30; previous revision: 1.29
done
Checking in
src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/FileCache.java;
/cvs/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/FileCache.java,v
 <--  FileCache.java
new revision: 1.7; previous revision: 1.6
done
Checking in
src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/LogFile.java;
/cvs/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/LogFile.java,v
 <--  LogFile.java
new revision: 1.3; previous revision: 1.2
done
Comment 6 Petr Nejedly 2005-02-22 14:54:15 UTC
Now it is fixed completly