System level language, GC, allocation and typeinfo

Qox via Digitalmars-d digitalmars-d at puremagic.com
Wed May 28 11:27:56 PDT 2014


> or maybe a branch/sub-set, GC-free, version of D arrays and 
> classes.

thumbs up for that. Everytime when i do OS-level or other 
programming in D, where i can't/won't have GC i can't have 
arrays/classes. One possibility is to hack the library but it 
either leaks memory(because you can't free it easily) or it looks 
bad on the allocation side.

what i mean with allocation side:

> Memory.setObject("FOO at 42")
> foobar[] xy = a.dup;

it esentially labels the allocated memory (with .dup) so it can 
be freed later... and it just is effectivly like a non-GC'ed 
malloc...

I would like some optional parameters for the non-GC allocations 
like

> foobar[] xy = a.dup(myAllocator, 42);

(dup grabs the memory from myAllocator and passes arguments). 
Same for new like good old GC does.

Ofcourse type information and the construction of more 
complicated objects is a problem.


More information about the Digitalmars-d mailing list