[1288] in java-interest
Re: Garbage collection
daemon@ATHENA.MIT.EDU (Chris Warth)
Mon Aug 28 22:16:56 1995
Date: Mon, 28 Aug 1995 14:55:03 -0700
From: csw@scndprsn.Eng.Sun.COM (Chris Warth)
To: phil@bga.com
Cc: java-interest@java.Eng.Sun.COM
>
> Several people wrote me to point out that Java uses a mark and sweep
> method to locate all unreferenced objects. Surely this is very
> inefficient - as it is order(number of objects) in time? Suppose I had
> 10**7 objects - not inconceivable? Am I missing something here?
>
I'd say you are. Just do the math - object handles in Java are a
minimum of 8 bytes - that is assuming there is *no data* to the object,
just methods.
So 10**7 objects times 8 bytes per object comes
out to a minimum heap of 76 Meg!!
When we started the project we were running heaps of 2Meg.
Then we ran for a long time with 3Meg Heaps. Now we use a growable
heap but in generals our heaps remain pretty small. If you have a 76
Meg heap of object handles alone then you have to write your own
garbage collector - sorry.
Paul Wilson's big survey of garbage collection techniques
- titled "Uniprocessor Garbage Collection Techniques" - is required
reading for GC enthusiasts. I don't have a URL for it but someone on
this list will surely send one.
-csw
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com