Proposal for dual memory management
Petr Janda
janda.petr at gmail.com
Wed Jul 28 06:07:25 PDT 2010
> Keep in mind that this would probably also be legal code:
> Foo f = new(alloc!Foo()) Foo();
Well I think the goal, according to Andrei, is to split allocation/construction
and deallocation/destruction.
>> dealloc(mp); //deallocate memory
>Again, this would require anybody who wants to manage memory to keep
>track of two variables per object. Is there a simpler alternative?
Yes but how to do this effectively without combining them back to one command like
delete? I mentioned in my first post that I'd prefer new and delete to behave like
it does in C++ (heap allocation) and Class.new for GC allocation, seeing as thats
not possible anymore due to TDPL, I don't know. I really know bugger all about D.
I know a little bit about C++ though, and if D2 wants to remain a system
programming language, it must have same "power" as C++, in particular manual
memory management.
I think what has to be done is clearly indicate which features of D can't be used
when managing your own memory. Best if compiler could warn us.
More information about the Digitalmars-d
mailing list