Skip to content

Commit 3bd21e7

Browse files
2 parents a08c5c4 + 1fd8bea commit 3bd21e7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Scoping is a fast way to deallocate many allocations at once. If for example you
4040
## Macros
4141
There are some helpful macros available to indicate how you want the MemoryPool to manage your memory allocations.
4242
* `#define MEMORYPOOL_DEFAULT_BLOCK_SIZE 1024 * 1024`: The MemoryPool allocates memory into blocks, each block can have a maximum size avalable to use - when it exceeds this size, the MemoryPool allocates a new block - use this macro to define the maximum size to give to each block. By default the value is `1024 * 1024` which is 1MB.
43-
* `#define MEMORYPOOL_SAFE_ALLOCATION`: When allocating with the `new` keyword the system won't check if the memory pool is a null pointer and will trust that it is not, this way checking if the memory pool is not null the job of the developer, but it makes things faster as it is easier for the branch predictor (as I found out through various tests). If this definition is defined then the 'new' keyword will check if the memory pool is null for you and return a `nullptr`.
43+
* `#define MEMORYPOOL_SAFE_ALLOCATION`: When allocating with the `new` keyword the system won't check if the memory pool is a null pointer and will trust that it is not, this way checking if the memory pool is not null is the job of the developer, but it makes things faster as it is easier for the branch predictor (as I found out through various tests). If this definition is defined then the 'new' keyword will check if the memory pool is null for you and return a `nullptr`.
4444

4545
# Methodology
4646
The MemoryPool is a structure pointing to the start of a chain of blocks, which size of every block is by default `MEMORYPOOL_BLOCK_MAX_SIZE` macro (See [Macros](#macros)) or the size passed into the `CPPShift::Memory::MemoryPoolManager::create(size)` function. The MemoryPoolManager is a component holding the necessary functions to work with the MemoryPool structure. What's also good is that you can also access the MemoryPool structure directly if needed.

0 commit comments

Comments
 (0)