<div dir="ltr"><div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Wait, what is returned by <span style="font-family:arial,sans-serif;font-size:13px">get-foreign-wrapper and are other references to it sticking around at that GC?</span></div>
</div></div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>As for the second question: yes, when I call (##gc) there are two weak references to the foreign object: one implied by the will that the library set on it, and other set by the user in the weak-valued hash table.  The foreign object is *not* garbage collected at this point, because there are still references to it.  But since none of these references is strong, the will that has it as testator will be made executable in the next garbage collection[1].  So I call (##gc) only to trigger that.  Sometime after the will has been made executable, its action procedure gets called, which is what releases the foreign object.<br>
<br>[1] In the current implementation of Gambit, wills are only made executable on garbage collections.  According to the docs, this may change in the future and shouldn't be relied upon.<br></div></div></div></div>