Ignore:
Timestamp:
Apr 29, 2011, 1:39:32 AM (11 years ago)
Author:
Sam Hocevar
Message:

lisp: if the Lisp permanent space grows out of memory, grow the space
during GCs instead of dying.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/lisp/lisp_gc.cpp

    r553 r554  
    233233}
    234234
    235 void collect_space(int which_space) // should be tmp or permanent
     235void collect_space(int which_space, int grow) // should be tmp or permanent
    236236{
    237237  int old_space = current_space;
     
    240240
    241241  space_size[GC_SPACE] = space_size[which_space];
     242  if (grow)
     243  {
     244    space_size[GC_SPACE] += space_size[which_space] >> 1;
     245    space_size[GC_SPACE] -= (space_size[GC_SPACE] & 7);
     246  }
    242247  uint8_t *new_space = (uint8_t *)malloc(space_size[GC_SPACE]);
    243248  current_space = GC_SPACE;
     
    255260
    256261  space[which_space] = new_space;
     262  space_size[which_space] = space_size[GC_SPACE];
    257263  free_space[which_space] = new_space
    258264                          + (free_space[GC_SPACE] - space[GC_SPACE]);
Note: See TracChangeset for help on using the changeset viewer.