DIP60: @nogc attribute

via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 16 23:19:56 PDT 2014


On Wednesday, 16 April 2014 at 23:14:27 UTC, Walter Bright wrote:
> On 4/16/2014 3:45 PM, "Ola Fosheim Grøstad" I've written 
> several myself that do not use malloc.

If it is shared or can call brk() it should be annotated.

> Even the Linux kernel does not use malloc. Windows offers many 
> ways to allocate memory without malloc. Trying to have a core 
> language detect attempts to write a storage allocator is way, 
> way beyond the scope of what is reasonable for it to do.

Library and syscalls can be marked, besides you can have dynamic 
tracing in debug mode.

> And, frankly, I don't see a point for such a capability.

Safe and contention free use of libraries in critical code paths. 
The alternative is to guess if it is safe to use.

> malloc is hardly the only problem people will encounter with 
> realtime callbacks. You'll want to avoid disk I/O, network 
> access, etc., too.

Yes, all syscalls. But malloc is easier to overlook and it might 
call brk() seldom, so detecting it without support might be 
difficult.



More information about the Digitalmars-d mailing list