[Vm-dev] Event-driven Cog: crashing in GC
golubovsky at gmail.com
Sat Jul 16 04:36:14 UTC 2011
I am trying to reproduce Andreas' experiment  with Stack Cog. It
always ends up with crash during garbage collection.
Andreas' approach was to my understanding as follows:
1. Set a jmp_buf to to hold the jump target at the start of the
2. longjmp to this jmp_buf in the transferTo function if its argument
is 0 (thus exiting the interpreter once no processes are ready to
3. in the wakeHighestPriority function do not terminate with error if
the list of ready to run processes is exhausted: just return 0 (which
goes to transferTo)
4. implement an external event loop in the hosting process polling for
events, entering the interpreter once any events are available.
My addition to this: heartbeat is no longer a separate thread: it is
invoked from either the lowest priority process (when
ioRelinquishProcessor is called) or right before entering the
interpreter from the external event loop if there are events.
Once I do-it in a running VM:
(ProcessorScheduler classPool at: #BackgroundProcess) terminate.
returns from the interpreter start occurring, transferTo is
periodically called with 0 argument, interpreter is not entered until
mouse is clicked etc.
But once garbage collection occurs, VM crashes on SEGV inside
markAndTrace. markAndTrace may be called with weird address like
30303030 (is this sort of magic number?)
If I disable GC completely, VM runs, responds to mouse clicks, I can
even open widgets but it crashes once memory exhausts.
How can process scheduler and GC conflict so terribly? What else am I missing?
Thanks for any ideas.
Anywhere on the Web
More information about the Vm-dev