Torque 3D 3.7
ContentsIndexHome
PreviousUpNext
DataChunker Class
DataChunker
Syntax
C++
class DataChunker;

Implements a chunked data allocator. 

Calling new/malloc all the time is a time consuming operation. Therefore, we provide the DataChunker, which allocates memory in blocks of chunkSize (by default 16k, see ChunkSize, though it can be set in the constructor), then doles it out as requested, in chunks of up to chunkSize in size

It will assert if you try to get more than ChunkSize bytes at a time, and it deals with the logic of allocating new blocks and giving out word-aligned chunks. 

Note that new/free/realloc WILL NOT WORK on memory gotten from the DataChunker. This also only grows (you can call freeBlocks to deallocate and reset things).

Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!