deprecated delete and manual memory management

Alexander aldem+dmars at nk7.net
Wed Apr 27 15:19:42 PDT 2011


On 27.04.2011 22:46, Dmitry Olshansky wrote:

> - there is an awful lot of operations which allocate GC memory implicitly aka arr1 ~ arr2, so it's not like you can pass the allocator and prevent the function from allocating _somewhere_ else

  This is solvable by using different runtime or class hierarchy, thus overriding "~" & co. Another option is to avoid constructs which may invoke GC (those are well-described).

> - I still fail to see how passing allocator would allow the function to decide on whether it's GC-like allocation or not, i.e. manual memory management implies the certain way function does its job (more generally the whole program, framework, module
> etc. it's not something decided at single call point)

  Again - different runtime and/or specialized class hierarchy. Custom (de)allocators are inherited, so one base class will do.

/Alexander


More information about the Digitalmars-d mailing list