Closed stephen-hqxu closed 3 years ago
STPMemoryPool will be out in the next release, it supports customisable allocator and deallocator with user-defined passing arguments.
Heightfield generator has been implemented with the new memory pool, and I am pleased to say that even without legit benchmarking, the computational time has been cutdown by a lot, even noticeable by inspection.
Current
In STPHeightfieldGenerator, each time a new chunk needs to be computed, new device memory is allocated. However once the computation is done, memory is freed.
It may cause some memory allcation overhead if there are a lot of chunks being computed at the same time.
Suggestion
Approach