<br><br><div class="gmail_quote">2013/6/18 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5"><br>It is not in Gambit, but it would be easy to modify the GC to do this.</div></div></blockquote><div><br></div><div>Right!</div><div><br></div><div>Three q:s on how to do this - </div>

<div><br></div><div><br><br>I'm reading mem.c right now and it looks like the mark_array() procedure would be the place to put this check in.</div><div><br></div><div>The GC copy phase is about changing every object reference to a new one. </div>

<div>So, if during the mark phase I'd print out the ___SCMOBJ of the referencing object, that would change during the GC.</div><div><br></div><div> * Where in mem.c is the copy phase implemented? I can't find it or any reference to it in ___garbage_collect , that would not be the section "Move the stack", would it??</div>

<div><br></div><div> * Could I safely run ___garbage_collect up to where the copy begins and then just return() it right there as to keep the validity of the references of the referencing objects I found?</div><div><br></div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">  By the way, your proposed API is not quite right because the references can be in non Scheme objects (for example global variables, a stack frame, a C allocated object).  Also, it could be that the object is a ___STILL object that has a non-zero reference count.</div>

</div></blockquote><div><br></div><div>That would be cool - the objects I'm looking to track references of are deep in the Scheme logics only and unrelated with any FFI or other special object management. So I'd guess the place to check for the object would be in the loop in mark_array:</div>

<div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div><div><br></div><div>  while (n > 0)</div><div>    {</div><div>      ___WORD obj = *start;</div><div><br>
</div>
<div>      <span style="background-color:rgb(255,255,204)">[Here - row 2100</span><span style="background-color:rgb(255,255,204)">]</span></div><div><br></div><div>      if (___MEM_ALLOCATED(obj))</div><div>        {</div>

<div>          ___WORD *body;</div><div>          ___WORD head;</div><div>          int head_typ;</div><div>          int subtype;</div></div></div></blockquote><div class="gmail_quote"><div><br></div><div><br></div><div>

<br></div><div> * Last, in mark_array, can I easily detect the object reference to the object whose content is being marked here, or do I need to add this as another argument to mark_array?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">  So a leak is possible if there's a missing reference count "decrement" in the code.</div></div></blockquote><div><br></div><div>Ah right - the nature of this memory leak is not such. The only ___STILL variables I have are u8vectors , and the issue I have is that some procedures and vectors fill up the heap - </div>

<div><br></div><div>##serial-number-to-object-table is growing up to heap overflow!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Marc<br>
<br>
<br>
</font></span></blockquote></div><br><div>Best regards,</div><div>Mikael</div><div><br></div>