[gambit-list] Garbage Collection BlackMagic

David St-Hilaire sthilaid at iro.umontreal.ca
Sun Jun 14 08:34:27 EDT 2009


lowly coder wrote:
> Maybe the right answer is "Don't do this in Gambit", but I'd like to give it
> a try:
> 
> I'm writing an application, in Gambit. It does OpenGL graphics. It runs at
> 100fps. It's interpreted.
> 
> Now, put down the pitch fork -- the only thing it's doing at 100Hz is
>   for 20 different objects
>     glLoadIdentity
>     glPushMatrix
>     some rotation
>     glCallList
>     glPopMatrix
> 
> This works fine, _except_ when I get hit with a gambit gc, it costs me like
> 70ms ... which becomes a noticable lag in my otherwise smoothly rotationg
> screen.

If your gc costs you about 70ms, that means that your probably allocating alot
of data in the heap (probably some closures?). You might want to try to limit
your memory allocation to, in the end, shorten your gc times.

Also, if you have big chunks of static data, ideally stuffed a flat format like
in a vector or something, then you can also do a (##stil-copy obj) such that the
gc will not move it in the heap after each collection. Of course, this wont work
for list like structures, but should work fine for big flat define-type instances.

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090614/ed1b0fb0/attachment.sig>


More information about the Gambit-list mailing list