Back to index

wims  3.65+svn20090927
Functions | Variables
memory.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "vdefs.h"

Go to the source code of this file.

Functions

void freeinit (Freelist *fl, int size)
char * getfree (Freelist *fl)
void makefree (Freenode *curr, Freelist *fl)
char * myalloc (unsigned n)

Variables

int sqrt_nsites
int siteidx
int total_alloc

Function Documentation

void freeinit ( Freelist fl,
int  size 
)

Definition at line 12 of file memory.c.

    {
    fl->head = (Freenode *)NULL ;
    fl->nodesize = size ;
    }

Here is the caller graph for this function:

char* getfree ( Freelist fl)

Definition at line 19 of file memory.c.

    {
    int i ;
    Freenode * t ;
    if (fl->head == (Freenode *)NULL)
        {
        t =  (Freenode *) myalloc(sqrt_nsites * fl->nodesize) ;
        for(i = 0 ; i < sqrt_nsites ; i++)
            {
            makefree((Freenode *)((char *)t+i*fl->nodesize), fl) ;
            }
        }
    t = fl->head ;
    fl->head = (fl->head)->nextfree ;
    return ((char *)t) ;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void makefree ( Freenode curr,
Freelist fl 
)

Definition at line 37 of file memory.c.

    {
    curr->nextfree = fl->head ;
    fl->head = curr ;
    }

Here is the caller graph for this function:

char* myalloc ( unsigned  n)

Definition at line 46 of file memory.c.

    {
    char * t ;
    if ((t=malloc(n)) == (char *) 0)
        {
        fprintf(stderr,"Insufficient memory processing site %d (%d bytes in use)\n",
        siteidx, total_alloc) ;
        exit(0) ;
        }
    total_alloc += n ;
    return (t) ;
    }

Here is the caller graph for this function:


Variable Documentation

int siteidx

Definition at line 13 of file main.c.

Definition at line 8 of file geometry.c.

Definition at line 43 of file memory.c.