harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Deakin <oliver.dea...@googlemail.com>
Subject Re: [General VM] GC strategy:how to garbage collect short-lived objects quickly.
Date Tue, 19 Sep 2006 10:06:58 GMT
Xiao-Feng Li wrote:
> On 9/18/06, Oliver Deakin <oliver.deakin@googlemail.com> wrote:
>> Xiao-Feng Li wrote:
>> > On 9/14/06, Jimmy, Jing Lv <firepure@gmail.com> wrote:
>> >> Interesting topic, I'm still dreaming of "free()" in Java (This dream
>> >> begins at the very beginning when I see Java, as C/C++ is my first
>> >> program language )However, it seems RI will never give us 
>> "free()". :)
>> >>
>> >> Only a thought, Java may offer a key word "temp", indicating that 
>> this
>> >> variety can be freed at once.
>> >
>> >
>> > Well, it is not so easy to support "free()" in JVM as it looks like,
>> > and may not really bring benefit. Even worse, it may introduce unsafe
>> > code, which was one of the major design goals of Java/JVM. That said,
>> > I agree that some hints by programmer to assist GC might be an
>> > interesting topic.
>>
>> There are always weak references to help out with short lived objects -
>> you know they will be collected fairly soon (should be within a few
>> gc cycles) - and soft references for longer lived ones. That's
>> about as close to free() as youll get for now!
>>
>> Regards,
>> Oliver
>>
>
> I don't understand. How can weak references help short-lived objects 
> reclaim?

Really what I'm saying is that this is the closest thing we have to a
hint to GC that objects can be collected soon - but it is not anything
like a proper free() call. There is no immediate reclaim of memory,
just the possibility that it will be reclaimed soon - and the object
may be garbage collected before you are finished with it!

Regards,
Oliver

>
> Thanks,
> xiaofeng
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

-- 
Oliver Deakin
IBM United Kingdom Limited


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message