7#include "core/fxcrt/fx_memory.h"
13#include "build/build_config.h"
14#include "core/fxcrt/fx_safe_types.h"
16#if defined(PDF_USE_PARTITION_ALLOC)
17#error "File compiled under wrong build option."
26void*
Alloc(size_t num_members, size_t member_size) {
27 FX_SAFE_SIZE_T total = member_size;
29 if (!total.IsValid() || total.ValueOrDie() >= kMallocSizeLimit)
31 return malloc(total.ValueOrDie());
34void*
Calloc(size_t num_members, size_t member_size) {
35 FX_SAFE_SIZE_T total = member_size;
37 if (!total.IsValid() || total.ValueOrDie() >= kMallocSizeLimit)
39 return calloc(num_members, member_size);
42void*
Realloc(
void* ptr, size_t num_members, size_t member_size) {
43 FX_SAFE_SIZE_T total = num_members;
45 if (!total.IsValid() || total.ValueOrDie() >= kMallocSizeLimit)
47 return realloc(ptr, total.ValueOrDie());
55 FX_SAFE_SIZE_T total = member_size;
59 return malloc(total.ValueOrDie());
72 void* result = calloc(length, 1);
74 FX_OutOfMemoryTerminate(length);
79 void* result = malloc(length);
81 FX_OutOfMemoryTerminate(length);
void * FX_ArrayBufferAllocate(size_t length)
void FX_InitializeMemoryAllocators()
void FX_ArrayBufferFree(void *data)
void * FX_ArrayBufferAllocateUninitialized(size_t length)
void * Alloc(size_t num_members, size_t member_size)
void * StringAlloc(size_t num_members, size_t member_size)
void * Realloc(void *ptr, size_t num_members, size_t member_size)
void StringDealloc(void *ptr)
constexpr size_t kMallocSizeLimit
void * Calloc(size_t num_members, size_t member_size)