78 #include <jasper/jas_config.h>
150 #if defined(JAS_FOR_INTERNAL_USE_ONLY)
172 #if defined(JAS_THREADS)
177 } jas_basic_allocator_t;
184 #if defined(JAS_FOR_INTERNAL_USE_ONLY)
187 extern jas_basic_allocator_t jas_basic_allocator;
236 void *
jas_calloc(
size_t num_elements,
size_t element_size);
243 void *
jas_alloc2(
size_t num_elements,
size_t element_size);
250 void *
jas_alloc3(
size_t num_arrays,
size_t array_size,
size_t element_size);
257 void *
jas_realloc2(
void *ptr,
size_t num_elements,
size_t element_size);
326 #if defined(JAS_FOR_INTERNAL_USE_ONLY)
332 void jas_basic_allocator_init(jas_basic_allocator_t *allocator,
JAS_EXPORT void * jas_malloc(size_t size)
Allocate memory.
Definition: jas_malloc.c:136
JAS_EXPORT void jas_allocator_cleanup(jas_allocator_t *allocator)
Clean up an allocator that is no longer needed.
Definition: jas_malloc.c:244
JAS_EXPORT void * jas_calloc(size_t num_elements, size_t element_size)
Allocate a block of memory and initialize the contents to zero.
Definition: jas_malloc.c:198
JAS_EXPORT void jas_std_allocator_init(jas_std_allocator_t *allocator)
Initialize a memory allocator that uses malloc and related functions for managing memory.
Definition: jas_malloc.c:262
JAS_EXPORT void jas_set_max_mem_usage(size_t max_mem)
Set the maximum memory usage allowed by the allocator wrapper.
Definition: jas_malloc.c:355
JAS_EXPORT void * jas_alloc2(size_t num_elements, size_t element_size)
Allocate array (with overflow checking).
Definition: jas_malloc.c:212
JAS_EXPORT void * jas_realloc2(void *ptr, size_t num_elements, size_t element_size)
Resize a block of allocated memory (with overflow checking).
Definition: jas_malloc.c:231
struct jas_allocator_s jas_allocator_t
A memory allocator.
JAS_EXPORT size_t jas_get_total_mem_size(void)
Get the total amount of memory available on the system.
Definition: jas_malloc.c:627
JAS_EXPORT void * jas_alloc3(size_t num_arrays, size_t array_size, size_t element_size)
Allocate array of arrays (with overflow checking).
Definition: jas_malloc.c:221
JAS_EXPORT size_t jas_get_mem_usage(void)
Get the current memory usage from the allocator wrapper.
Definition: jas_malloc.c:370
JAS_EXPORT void * jas_realloc(void *ptr, size_t size)
Resize a block of allocated memory.
Definition: jas_malloc.c:151
JAS_EXPORT void jas_free(void *ptr)
Free memory.
Definition: jas_malloc.c:186
A memory allocator.
Definition: jas_malloc.h:101
void(* cleanup)(struct jas_allocator_s *allocator)
Definition: jas_malloc.h:109
void(* free)(struct jas_allocator_s *allocator, void *pointer)
Definition: jas_malloc.h:121
The standard library allocator (i.e., a wrapper for malloc and friends).
Definition: jas_malloc.h:143