35 int chunk_size,
void *ptr,
int element_size)
42 fprintf(stderr,
"\nERROR: out of memory. memory asked for: %d\n",
55 to_alloc = *n_elements;
58 if (n_wanted < to_alloc)
76 while (n_wanted >= to_alloc)
77 to_alloc += *n_elements ? *n_elements : chunk_size;
81 ptr =
G_calloc(to_alloc, element_size);
83 ptr =
dig__frealloc((
char *)ptr, to_alloc, element_size, *n_elements);
85 *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__frealloc(void *oldptr, int nelem, int elsize, int oldnelem)
void * dig_frealloc(void *oldptr, int nelem, int elsize, int oldnelem)
void G_free(void *)
Free allocated memory.
void G_sleep(unsigned int)
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__alloc_space(int n_wanted, int *n_elements, int chunk_size, void *ptr, int element_size)
void * dig_falloc(int nelem, int elsize)