[PD] Re: Sharing sound-fonts (again)

Thomas Grill gr at grrrr.org
Sun Feb 6 17:19:38 CET 2005


> > One related questions - is it safe to use C++ STL as is, or should I
redefine
> > the allocator to use pd_new (or whatever it's called)?
>
> Recently Thomas wrote something about flext redefining new and delete
> anyway, maybe he can add some details on this?

I think it is in principle "safe" to use the C library new and delete
(because if i remember correctly pd currently also uses malloc and free
which is the same), but it's probably recommendable to define the STL
allocators to use getbytes and freebytes, because the PD implementation
might change to something faster/better.
The problem is, that PD memory allocation has a small overhead with C++,
since you need the size of allocated memory also for freeing it (it's used
for debugging of memory usage) - therefore you need to store this bytecount
too. You can look at the flext solution of this in flsupport.h.

best greetings,
Thomas





More information about the Pd-list mailing list