[Larceny-users] freezing for garbage collection?

Matthew Parker mparker at cse.unr.edu
Tue Mar 4 18:08:10 EST 2008


Will running the game in a thread work?  I suppose I'd have two threading 
options; either running it with pthread through the C library, or using 
the threading functions that appear in the MzScheme section.

I tried running it with your options and there were still pauses (less 
frequent, but just as large delays).  Could I set it so there are frequent 
small garbage collections, like one after every frame of the game, with 
no apparent pause? 
Perhaps I could manually call the collector after every frame?  I really 
can't have any noticeable pauses in the game since it will mess up the 
AI's behavior.

Matt

On Tue, 4 Mar 2008, William D Clinger wrote:

> Matt wrote:
>> I did this in chicken scheme and it worked very well, but
>> I decided to switch to larceny since chicken is quite slow
>> in comparison.  I've got it all working except I notice
>> that every so often the game will freeze up for a split
>> second, noticably, and then resume its normal speed.  Is
>> this due to the garbage collector?
>
> Probably.
>
> I would generally expect Larceny's garbage collector
> to perform better than Chicken's, but Larceny's heap
> image might be substantially larger than Chicken's or
> its default gc settings may be sub-optimal for your
> application.
>
>> Is there any way to fix this by changing the gc
>> settings, or by running things in a thread?
>
> There are several gc-related things you can try.  The
> first step is to see which settings make a noticeable
> difference.  Here's what I'd suggest:
>
>    % larceny -size0 4M -areas 3 -nocontract
>
> If that helps, then you can determine which of the
> three things are helping ("-size0 4M", "-areas 3",
> and "-nocontract") by leaving them out.  If one of
> the first two things help, then you can try increasing
> the size of the nursery and/or ephemeral area still
> further.
>
> For an explanation of these settings, type
>
>    % larceny --wizard
>
> Although you don't ordinarily want to use the --annoy-user
> switch, you may find that it helps you to understand the
> effect of other switches.
>
> With Larceny's current garbage collectors, there is no
> way to avoid an occasional long pause, but at least some
> of the settings suggested above should make those pauses
> less frequent.
>
> Will
>



More information about the Larceny-users mailing list