<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Marcel,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 27, 2022 at 10:22 AM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div id="gmail-m_-3897316910183689291__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr">Hi Eliot, hi all --<div></div><div><br></div><div>Can a pinned object get garbage collected at all? Do I have to ensure to have at least a single reference to that (pinned) object?</div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Yes and yes.</div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div id="gmail-m_-3897316910183689291__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr"><div><br></div><div>My best answer would be: Yes. Otherwise, I could never get rid of that pinned object again.</div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Indeed.</div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div id="gmail-m_-3897316910183689291__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr"><div><br></div><div>This has interesting implications also for an FFI programming interface. If you send out a pointer to object memory everything is fine if (a) that object is pinned an (b) that object does not get garbage collected. Pinning is easy. Keeping track of an object that gets collected but is actually pinned should raise a warning ... I suppose. Hmm...</div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">This has always been the case (and in all Smalltalks with which I'm familiar). It is orthogonal to the pinning issue.  Any object passed to external code must be registered and managed manually for the duration of its external use to prevent it being prematurely collected, since the GC tracks only internal references to objects.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Note that at the FFI/plugin level the VM offers addGCRoot & removeGCRoot for use by external and plugin code to do the management itself.</div></div><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>