In C++, there exists an inplace-new operator to create an object using preallocated memory. Is there an equivalent option in Delphi?
There is no direct equivalent (that I know of), but you can achieve much the same effect (controlling how and where memory for an object type is allocated) by overriding the NewInstance class function in your custom class and providing an implementation, which provides the space for the new instance from a custom heap pool.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With