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 51505 - FileCache grows too much
Summary: FileCache grows too much
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P1 blocker (vote)
Assignee: Martin Matula
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2004-11-15 09:54 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:54:21 UTC
Scenario from issue 51384.

I realized there is more CachedPages than should
be there (IIRC 128 pages)
I've found >1400 CachedPages, referencing
together ~3MB of byte arrays. All of the
CachedPages are referenced from static ArrayList
FileCache.pages, so it seems that the limiting the
number of CachedPages is somehow
broken. Moreover, some of the CachedPages belong
to the databases of closed
projects and they keep referencing some other
data, like long filename Strings (issue 51504)
and other objects related to MDR.

This should be at least analyzed and well
understood for 4.0
Comment 1 Petr Nejedly 2004-11-15 15:11:27 UTC
closing and opening the same projects lead to higher and higher number
of CachedPage instances.
Comment 2 Antonin Nebuzelsky 2004-11-15 15:32:26 UTC
and the growth is quite high:

start with nbbuild/misc - 1458 pages
close all - heap goes down to 18MB
reopen all - pages go up to 3281
close all - heap goes down only to 24MB
reopen all - pages go up to 4922
close all - heap goes down only to 31MB
reopen all
close all - heap goes down only to 34MB
reopen all - pages go up to 7383
close all - heap goes down only to 43MB
atd...
Comment 3 Martin Matula 2004-11-15 23:34:31 UTC
I found out that the growing number of pages when having many
classpath elements is caused by a per-storage mini-cache of 5 b-tree
pages for working with indexes. This means that for the whole
nbbuild/misc project consisting of aprox. 320 CP elements 1600 pages
can be held by the b-tree cache. This confirms Petr's findings. This
problem alone would not be that serious.
A bigger problem is that the pages held by the mini b-tree cache are
not freed from FileCache when the corresponding storage is unmounted.
This results in growing number of these pages when repeatedly opening
and closing projects. Tonda says the increment of the used memory is
"quite high", which is a relative term. I think it is not high enough
to be a showstopper if you consider that it is quite a corner case to
repeatedly open and close a project containing 320 classpath roots 4
or more times during a single IDE session. Even then, the IDE would
consume 25MB more, which should still not cause any significant
problems even with the default max. heap size setting.

Although I already have a fix for this issue and will integrate it to
the main trunk by the end of this week (after it will be tested by the
performance team), I consider this fix too risky to be merged into the
release40 branch at this point.
Comment 4 Martin Matula 2004-11-16 15:56:31 UTC
Fixed in trunk (see commits below). There can still be more pages in
memory because of the mentioned minicache, which we are not going to
remove now, since it will be removed by rewriting the btree to mmapped
files. But these pages are now properly gc'ed when the corresponding
storage files are unmounted.

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.5; previous revision: 1.4
done
Checking in
src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/IntrusiveList.java;
/cvs/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/IntrusiveList.java,v
 <--  IntrusiveList.java
new revision: 1.4; previous revision: 1.3
done
Comment 5 Jan Chalupa 2004-11-18 16:05:29 UTC
Please prepare a fix for 4.0. Thanks.
Comment 6 Martin Matula 2004-11-20 00:03:08 UTC
Fixed in release40.

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.3.10.2; previous revision: 1.3.10.1
done
Checking in
src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/IntrusiveList.java;
/cvs/mdr/src/org/netbeans/mdr/persistence/btreeimpl/btreestorage/IntrusiveList.java,v
 <--  IntrusiveList.java
new revision: 1.3.70.1; previous revision: 1.3
done
Comment 7 Petr Nejedly 2004-11-22 13:23:35 UTC
Verified in release4.0