Good examples of value types

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Wed May 6 10:12:19 PDT 2015


On Wednesday, 6 May 2015 at 09:20:50 UTC, Russel Winder wrote:
> On Wed, 2015-05-06 at 02:07 +0000, deadalnix via Digitalmars-d 
> wrote:
>> 
> […]
>> Let me tell you an actual war story of mine.
>
> I think you need to date the story, and say with GC was being 
> used.
>

It is relatively recent (a little more than 2 years ago). Any 
generational GC would have trashed the same way.

>> We have this program that is computationally intensive written 
>> in java. Somewhere in the core of the program, we have a LRU 
>> cache, with some entries sticking in there, and most entry 
>> getting evicted soon enough (typical pareto kind of thing).
>> 
>> Problem is, all these entries needs to be value types (we are 
>> in java) and, by the time things gets evicted from the LRU 
>> cache, they have moved to the old generation.
>> 
>> The whole damn thing generate a ton of garbage.
>
> I suspect this was not using G1 as tons of garbage isn't as 
> much of a
> problem compared to CMS, etc.
>

All of them would have trashed the same way. Generational GC bet 
on the fact that most object dies young. In that case, it is 
true, but object are kept live long enough because of the LRU 
that the GC promote them, and they only get collected when the 
full collection kicks in.


More information about the Digitalmars-d mailing list