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 51645 - Welcome module keeps large image in memory
Summary: Welcome module keeps large image in memory
Status: CLOSED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Welcome (show other bugs)
Version: 4.x
Hardware: All All
: P1 blocker (vote)
Assignee: Ondrej Rypacek
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2004-11-18 14:11 UTC by Petr Nejedly
Modified: 2006-03-24 09:48 UTC (History)
2 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-18 14:11:48 UTC
All the welcome screen UI, including a 1MB large
image is strongly statically referenced in the IDE
even after the welcome screen is dismissed. This
presents at least a 1MB memory leak.

Workaround is to close the welcome screen and
restart the IDE.

Although the leak is constant and typically
present only for the first usage of the IDE, I
think it could be fixed for 4.0 as the fix should
be trivial and it affects all users.
Comment 1 Ondrej Rypacek 2004-11-18 17:05:03 UTC
Yeah, that should be easy. I'll WeakReference it.
Comment 2 Ondrej Rypacek 2004-11-19 09:41:28 UTC
fixed in trunk by changing the static reference to WelcomeComponent
singleton instance to a WeakReference. Checked in profiler that there
is no other reference to the instance and that it is really being
disposed.

committed to trunk: o/n/m/w/WelcomeComponent.java rev1.3
http://ide.netbeans.org/source/browse/ide/welcome/src/org/netbeans/modules/welcome/WelcomeComponent.java.diff?r1=1.2&r2=1.3
Comment 3 Jan Chalupa 2004-11-19 09:46:47 UTC
Fix required for 4.0. Please go through the high res process.
Comment 4 Richard Gregor 2004-11-19 10:01:39 UTC
Diff reviewed without objections.
Comment 5 Ondrej Rypacek 2004-11-19 14:07:37 UTC
As pointed out by Petr Nejedly, there was a bug in manipulation of the
weak reference.

> The fix is wrong. Idea is OK, but the implementation isn't.
> you can't safely do:
>
> if (wr.get()!=) return wr.get();
>
> proper code is:
> 
> Object o = wr.get();
> if (o != null) return o;
  

I fixed it and commited a new version 1.4
The diff is here
http://ide.netbeans.org/source/browse/ide/welcome/src/org/netbeans/modules/welcome/WelcomeComponent.java.diff?r1=1.3&r2=1.4
Comment 6 Jan Chalupa 2004-11-22 09:46:30 UTC
Fixed in release40.
Comment 7 Petr Nejedly 2004-11-22 12:15:07 UTC
Verified in release4.0
Note: One have to move focus somewhere after closing the component to
really free it, due to design of WinSys.