MCPcopy Create free account
hub / github.com/cinience/RedisStudio / Malloc

Method Malloc

include/rapidjson/allocators.h:168–176  ·  view source on GitHub ↗

Allocates a memory block. (concept Allocator)

Source from the content-addressed store, hash-verified

166
167 //! Allocates a memory block. (concept Allocator)
168 void* Malloc(size_t size) {
169 size = RAPIDJSON_ALIGN(size);
170 if (chunkHead_ == 0 || chunkHead_->size + size > chunkHead_->capacity)
171 AddChunk(chunk_capacity_ > size ? chunk_capacity_ : size);
172
173 void *buffer = reinterpret_cast<char *>(chunkHead_ + 1) + chunkHead_->size;
174 chunkHead_->size += size;
175 return buffer;
176 }
177
178 //! Resizes a memory block (concept Allocator)
179 void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) {

Callers 5

AddChunkMethod · 0.80
document.hFile · 0.80
SetArrayRawFunction · 0.80
SetObjectRawFunction · 0.80
SetStringRawFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected