Garbage collection related problem starting the GUI

Project:JNode Core
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

It is well known to JNode developers that the best way to start the GUI is to boot JNode into console mode (with all plugins loaded), run "gc", and then run "startawt". If you run "startawt" without running "gc" first, the GUI is liable to freeze.

This is a clearly bug. My guess is that it is in the GC scheduling code.

GC Issue

Shouldn't we be looking into the bootup phase of JNode to determine how we can shrink memory usage and or add a garbage collect after the booting initializes?

That doesn't address the real problem.

The former idea would be a good thing, though it is not easy to achieve I imagine. The latter idea is a hack ... like my patch. (A modern GC is most efficient when there is a maximal amount of garbage to reclaim. Forcing the GC to run actually results in more time being spent GC'ing than is necessary.)

The real problem here is more fundamental. It appears that the GC works if we call it explicitly before we run startawt, but it doesn't work if it is triggered automatically while the GUI is initializing. Something is clearly broken.

Okay. I'll look into the

Okay. I'll take a peak into the GUI initialization code to see what is going on.

not sure it's a GUI specific situation

I have not looked at the problem but I suspect the problem is more related to compilation (GUI is a case that force to compile a lot of classes at the first use) and/or garbage collection (due to heavy use of compiler and classloading at GUI startup, there is a big increase in memory needs).

So, I am not sure it is a GUI specific problem and there should be a (junit) test for reproducing that bug.

Fabien

my blog (in english and french)

Pretty sure you are right ...

... because I see similar behavior when I run the "javac" command for the first time. (You need to boot JNode with all plugins loaded to see the "javac" command.)

#1

The attached patch (against 3397) is a temporary workaround for the problem that simply calls System.gc() before launching the windowing system.

It means that we can avoid having to tell new users (e.g. in the User Guide) to run the 'gc' command before running 'startawt'.

Yea, its a hack. Maybe someone will be motivated to address the underlying problem with the GC sometime soon.

#1

Status:active» fixed

Fixed in trunk. Should be covered by this bug.

#2

Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.