Back to index

lightning-sunbird  0.9+nobinonly
macgc.c File Reference
#include "primpl.h"
#include "MacMemAllocator.h"

Go to the source code of this file.


void _MD_InitGC ()
void_MD_GrowGCHeap (size_t *sizep)
void _MD_FreeGCSegment (void *base, int32)

Function Documentation

void _MD_FreeGCSegment ( void base,

Definition at line 72 of file macgc.c.

void* _MD_GrowGCHeap ( size_t *  sizep)

Definition at line 43 of file macgc.c.

       void                 *heapPtr = NULL;
       size_t               heapSize = *sizep;
       // In previous versions of this code we tried to allocate GC heaps from the application
       // heap.  In the 4.0 application, we try to keep our app heap allications to a minimum
       // and instead go through our own memory allocation routines.
       heapPtr = malloc(heapSize);
       if (heapPtr == NULL) {             
              FreeMemoryStats             stats;
              memtotal(heapSize, &stats);        // How much can we allcoate?
              if (stats.maxBlockSize < heapSize)
                     heapSize = stats.maxBlockSize;
              heapPtr = malloc(heapSize);
              if (heapPtr == NULL)                      // Now we're hurting
                     heapSize = 0;
       *sizep = heapSize;
       return heapPtr;

Definition at line 41 of file macgc.c.