[Vm-dev] Ephemerons support in VM

Guille Polito guillermopolito at gmail.com
Tue Apr 12 13:22:36 UTC 2016


I can for sure help with that!

Just tell me either the repo where you had the finalization queue 
changes, or a start pointer. I can test, chase bugs or even write unit 
tests for this :).

I understand from your email that you cannot have both finalization 
mechanisms active at the same time (which would be nice to test).

Cheers,
Guille

-------- Original Message --------
>   
> Hi both,
>
>> On Apr 12, 2016, at 12:45 AM, Guille Polito <guillermopolito at gmail.com> wrote:
>>
>> Hi Eliot, list,
>>
>> What is the state of Ephemeron support in the VM? I see that in Pharo we already have modified the class builder to produce ephemeric classes, but there is none yet :).
>>
>> The thing is that we spent last week here at RMoD chasing a memory leak that made tools remain in memory indefinitely due to some bad assumptions on how to use weak objects :).
>>
>> In short: Announcements use finalizers/executors that hold (indirectly) strong references to weak keys. And this is aggravated because this happens in chains/cycles among several finalizers/executors.
>> Eg. executor1 points to weakkey2, executor2 points to weakkey3 and so on...
>>
>> Besides forcing some rules of usage of announcers (and weak announcers), we believe part of this problem would be solved by ephemerons.
>>
>> Thanks for some pointers!
>> Guille & Pavel
> forgive me for replying to your later message  to the Pharo list sooner, a side effect of the way I read email in my phone when I wake up in the middle of the night ?!  Further, being in my phone I need to read the code to give you accurate answers, but what I'll say is at least close to the truth.
>
> So....
>
> First, the ephemeron support uses a queue (an "objStack") in the VM to queue mourning ephemerons.  A flag in the VM, stored in the image header and accessible via vmParameterAt:put: controls whether weak collections are added to the ephemeron queue to mourn instead of signaling the finalization semaphore and requiring a full scan of all weak registries.  When I add changed finalization support and set the flag chaos ensues and I end up with no sources.  Help, or a few days in which I have nothing else to do (the latter is unlikely to appear until imminent societal collapse) are needed to understand why.
>
> I'll try and dig out the code I have soon, but it'll be early tomorrow your time.
>
> _,,,^..^,,,_ (phone)



More information about the Vm-dev mailing list