Hi guys. I am doing some hacky things and I have a problem. I am sure it is not VM&#39;s fault but mine. I would just like to understand what could be happening.<br><br>Scenario: I have developed an &quot;object graph swapper&quot; which basically takes a graph, and replaces each object of the graph by a proxy. Then the graph is serialized and swapped out to a file. The proxies then intercept messages and materialize from file, and replaces proxies with the materialized objects. When I am swapping out, after I become original objects to proxies, the only reachable proxies are the proxies for the roots and for objects inside the graph which were also referenced from outside the graph. All the rest of the proxies (for objects only reachable from inside the graph) can be garbage collected without problem.<br>




<br>Problem: I am swapping out several graphs one after another one. If after swapping out each graph, I do a GC, then I have no problem. I can swap lots of graphs. However, if I start to swap several graphs but I do not run a gc after each graph, then I have a crash in the VM. The crash happens when becoming original objects to proxies. More precisely it crashes in:<br>




<br>remappedObj: forwardedObj<br>    &quot;Answer the given forwardedOop&#39;s target value<br>     during a compaction or become: operation.&quot;<br>    | fwdBlock targetObj |<br>    &lt;inline: true&gt;<br>    fwdBlock := self forwardingPointerOf: forwardedObj.<br>




    self assert: (self fwdBlockValid: fwdBlock).<br>    targetObj := self longAt: fwdBlock.<br>    self assert: (self addressCouldBeObjWhileForwarding: targetObj).<br>    ^targetObj<br><br>line  targetObj := self longAt: fwdBlock.<br>




it seems fwdBlock has a negative value (I debugged the VM and checked its value) and then the longAt:   gives EXC_BAD_ACCESS.<br><br>My question is, can you imagine something that could be causing the crash?  I would like to understand what is happening. Maybe I am becoming objects which are not reachable anymore and that fails?<br>




Any hint is really appreciated. <br><br>Some investigations: sometimes it fails, but sometimes it works (I think this is because on when the GC runs). It seems that when it breaks, in #remapFieldsAndClassOf:   the oop is a CompiledMethod and so the fieldOffset is the last literal, that is the assocation to the class. Since I also replace classes with proxies, such association has a ClassProxy in its value. Such class contains the 3 intsVars superclass, methodDict and format so that not to crash VM. Format is set with ClassProxy format.   <br>
More information is that it doesn&#39;t crash in StackVM... moreover, it doesn&#39;t crash if I DO NOT create proxies for CompiledMethod .... looks like something with them ... So.... can this give you a hint?<br>


<br>Thanks<br><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>