20 #include <grass/Vect.h>
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((
unsigned)to_alloc, (
unsigned)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");
129 ptr = G_calloc((
unsigned)nelem, (
unsigned)elsize);
144 ptr = G_calloc((
unsigned)nelem, (
unsigned)elsize);
155 n = oldnelem * elsize;
void * dig__frealloc(void *oldptr, int nelem, int elsize, int oldnelem)
void G_free(void *buf)
Free allocated memory.
void * dig_frealloc(void *oldptr, int nelem, int elsize, int oldnelem)
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 G_sleep(unsigned int seconds)
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)