41 fprintf(stderr,
"\nERROR: out of memory. memory asked for: %d\n",
50 int n_wanted,
int *n_elements,
int chunk_size,
56 to_alloc = *n_elements;
59 if (n_wanted < to_alloc)
77 while (n_wanted >= to_alloc)
78 to_alloc += *n_elements ? *n_elements : chunk_size;
82 ptr =
G_calloc(to_alloc, element_size);
84 ptr =
dig__frealloc((
char *)ptr, to_alloc, element_size, *n_elements);
86 *n_elements = to_alloc;
96 fprintf(stderr,
"Out of Memory.\n");
108 fprintf(stderr,
"\nOut of Memory on realloc.\n");
155 n = oldnelem * elsize;
void * dig_falloc(int nelem, int elsize)
void * dig_alloc_space(int n_wanted, int *n_elements, int chunk_size, void *ptr, int element_size)
void * dig__frealloc(void *oldptr, int nelem, int elsize, int oldnelem)
void * dig_frealloc(void *oldptr, int nelem, int elsize, int oldnelem)
void * dig__alloc_space(int n_wanted, int *n_elements, int chunk_size, void *ptr, int element_size)
void * dig__falloc(int nelem, int elsize)
void G_free(void *)
Free allocated memory.
void G_sleep(unsigned int)