[squeak-dev] About a object life

Mariano Martinez Peck marianopeck at gmail.com
Mon Nov 5 13:03:47 UTC 2012


On Mon, Nov 5, 2012 at 1:28 PM, Bert Freudenberg <bert at freudenbergs.de>wrote:

> On 2012-11-03, at 22:45, Mariano Martinez Peck <marianopeck at gmail.com>
> wrote:
>
> > On Sat, Nov 3, 2012 at 3:26 PM, Edgar J. De Cleene <
> edgardec2005 at gmail.com> wrote:
> >> Folks:
> >>
> >> I wish know how old a object is.
> >>
> > The VM can know if an object is in the young or old area. You could
> modify the VM and make a primitive that answers this (#isYoung: anOop).
>
> What's wrong with the existing primitiveIsYoung? ;)
>
>
Sorry, I though we only had #isYoung:  and I forgot we also had the
primitiveIsYoung and even the image side message :)



> SmalltalkImage current isYoung: true
> ==> false
>
> SmalltalkImage current isYoung: Object new
> ==> true
>
>
> Also, since our GC does not change the order of objects when compacting,
> you can tell if an object is older than another by enumerating all objects.
> The oldest ones are of course nil, false, and true (more than 30 years old
> now):
>
>

This is very interesting!!!
Thanks Bert.


> (1 to: 20) inject: self someObject into: [:obj :i |
>         Transcript show: i; space; show: (obj printString contractTo: 60);
> cr.
>         obj nextObject]
> ==>
> 1 nil
> 2 false
> 3 true
> 4 #Processor->a ProcessorScheduler
> 5 #(#+ 1 #- 1 #< 1 #> 1 #<= 1 #... 1 #new 0 #new: 1 #x 0 #y 0)
> 6 {Character value: 0 . Charact...$ú . $û . $ü . $ý . $þ . $ÿ}
> 7 {CompiledMethod . nil . Array...nil . nil . nil . nil . nil}
> 8 #Transcript->a TranscriptStream ' '
> 9 #SourceFiles->an ExpandedSour...s/Work/Frank/frank.changes')
> 10 #Display->DisplayScreen(1920x1200x32)
> 11 #Sensor->an EventSensor
> 12 $'
> 13 $,
> 14 $-
> 15 $.
> 16 $0
> 17 $;
> 18 $=
> 19 $[
> 20 $_
>
>
> - Bert -
>
>
>


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20121105/ac5f3b04/attachment.htm


More information about the Squeak-dev mailing list