Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
unixgc.c File Reference
#include "prlock.h"
#include "prlog.h"
#include "prmem.h"
#include "gcint.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>

Go to the source code of this file.


#define _PR_GC_VMBASE   0x40000000


void _MD_InitGC (void)
void_MD_GrowGCHeap (PRUint32 *sizep)
PRBool _MD_ExtendGCHeap (char *base, PRInt32 oldSize, PRInt32 newSize)
void _MD_FreeGCSegment (void *base, PRInt32 len)


static PRInt32 zero_fd = -1
static PRLockzero_fd_lock = NULL
static voidlastaddr = (void*) _PR_GC_VMBASE

Define Documentation


Definition at line 56 of file unixgc.c.

#define _PR_GC_VMBASE   0x40000000

Definition at line 49 of file unixgc.c.

Function Documentation

PRBool _MD_ExtendGCHeap ( char *  base,
PRInt32  oldSize,
PRInt32  newSize 

Definition at line 143 of file unixgc.c.

       return PR_FALSE;
void _MD_FreeGCSegment ( void base,
PRInt32  len 

Definition at line 148 of file unixgc.c.

       if (zero_fd < 0) {
       } else {
              (void) munmap(base, len);

Here is the call graph for this function:

void* _MD_GrowGCHeap ( PRUint32 sizep)

Definition at line 80 of file unixgc.c.

       void *addr;
       PRUint32 size;

       size = *sizep;

       if (zero_fd < 0) {
              goto mmap_loses;

       /* Extend the mapping */
       addr = mmap(lastaddr, size, PROT_READ|PROT_WRITE|PROT_EXEC,
           zero_fd, 0);
       if (addr == (void*)-1) {
              zero_fd = -1;
              goto mmap_loses;
       lastaddr = ((char*)addr + size);
#ifdef DEBUG
       PR_LOG(_pr_msgc_lm, PR_LOG_WARNING,
           ("GC: heap extends from %08x to %08x\n",
           _PR_GC_VMBASE + (char*)lastaddr - (char*)_PR_GC_VMBASE));
       return addr;

       return PR_MALLOC(size);

Here is the call graph for this function:

Definition at line 62 of file unixgc.c.

#ifdef DEBUG
     * Disable using mmap(2) if NSPR_NO_MMAP is set
    if (getenv("NSPR_NO_MMAP")) {
        zero_fd = -2;
    zero_fd = open("/dev/zero",O_RDWR , 0);
    zero_fd_lock = PR_NewLock();

Here is the call graph for this function:

Variable Documentation

void* lastaddr = (void*) _PR_GC_VMBASE [static]

Definition at line 78 of file unixgc.c.

PRInt32 zero_fd = -1 [static]

Definition at line 59 of file unixgc.c.

PRLock* zero_fd_lock = NULL [static]

Definition at line 60 of file unixgc.c.