Skip to content

Commit

Permalink
Added macro RAPIDJSON_ALLOCATOR_DEFAULT_CHUNK_CAPACITY to allow defau…
Browse files Browse the repository at this point in the history
…lt chunk capacity to be lowered for embedded devices with < 64k stack sizes
  • Loading branch information
k3rb3ros committed Apr 17, 2018
1 parent 8022a5f commit 6f58746
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion include/rapidjson/allocators.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ concept Allocator {
\endcode
*/


/*! \def RAPIDJSON_ALLOCATOR_DEFUALT_CHUNK_CAPACITY
\ingroup RAPIDJSON_CONFIG
\brief User-defined kDefaultChunkCapacity definition.
User can define this as any \c size that is a power of 2.
*/

#ifndef RAPIDJSON_ALLOCATOR_DEFAULT_CHUNK_CAPACITY
#define RAPIDJSON_ALLOCATOR_DEFAULT_CHUNK_CAPACITY (64 * 1024)
#endif


///////////////////////////////////////////////////////////////////////////////
// CrtAllocator

Expand Down Expand Up @@ -248,7 +261,7 @@ class MemoryPoolAllocator {
return false;
}

static const int kDefaultChunkCapacity = 64 * 1024; //!< Default chunk capacity.
static const int kDefaultChunkCapacity = RAPIDJSON_ALLOCATOR_DEFAULT_CHUNK_CAPACITY; //!< Default chunk capacity.

//! Chunk header for perpending to each chunk.
/*! Chunks are stored as a singly linked list.
Expand Down

0 comments on commit 6f58746

Please sign in to comment.