Am 17.05.21 um 00:19 schrieb Kristian Amlie:
In the places where we can not, I would suggest using shared_ptr or unique_ptr. This won't get rid of the allocation cost, but will at least reduce the need for memory management (so we can be lazy!).
I'm definitely in favor.
That is a route I'd also favour. Plus a factory creating that smart-ptr. Bonus points if we get away with unique_ptr alone (zero overhead). Even more so, because, once you've put the management of allocations behind a factory+smart-ptr, you can very easily use a custom allocation scheme. Because, after all, Heap memory is not evil as such. What makes it problematic is the cost of using a general purpose allocation scheme for lots of small allocations. And the danger of fragmentation, which kills cache locality. A specialised pooling allocator can address those problems quite well. And it can be optimised for a well-known allocation trend. -- Hermann _______________________________________________ Yoshimi-devel mailing list Yoshimi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/yoshimi-devel