21 template <
typename Allocator>
23 EXPECT_TRUE(a.Malloc(0) == 0);
27 for (
size_t i = 0; i < 100; i++)
28 p[i] = static_cast<uint8_t>(i);
33 for (
size_t i = 0; i < 100; i++)
35 for (
size_t i = 100; i < 200; i++)
36 q[i] = static_cast<uint8_t>(i);
41 for (
size_t i = 0; i < 150; i++)
47 EXPECT_TRUE(a.Realloc(a.Malloc(1), 1, 0) == 0);
59 for (
size_t i = 1; i < 1000; i++) {
60 EXPECT_TRUE(a.
Malloc(i) != 0);
66 #if RAPIDJSON_64BIT == 1 88 void* q = a.
Realloc(p, 100, 200);
92 for (
size_t j = 1; j < 32; j++) {
96 for (
size_t i = 1; i < 1024; i++) {
TEST(Allocator, CrtAllocator)
size_t Capacity() const
Computes the total capacity of allocated memory chunks.
void * Malloc(size_t size)
Allocates a memory block. (concept Allocator)
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
size_t Size() const
Computes the memory blocks allocated.
void TestAllocator(Allocator &a)
void Clear()
Deallocates all memory chunks, excluding the user-supplied buffer.
unsigned __int64 uint64_t
Concept for allocating, resizing and freeing memory block.
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
void * Realloc(void *originalPtr, size_t originalSize, size_t newSize)
Resizes a memory block (concept Allocator)
C-runtime library allocator.
#define RAPIDJSON_ALIGN(x)
Data alignment of the machine.
Default memory allocator used by the parser and DOM.