DIP60: @nogc attribute

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 18 17:08:54 PDT 2014


Am Thu, 17 Apr 2014 06:19:56 +0000
schrieb "Ola Fosheim Grøstad"
<ola.fosheim.grostad+dlang at gmail.com>:

> 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.

It's a bit of a grey zone. There are probably real-time
malloc() implementations out there. And syscalls like mmap()
can be used to allocate virtual memory or just to map a file
into virtual memory. If you mark all syscalls that doesn't
matter of course.

At the end of the day you cannot really trace what a library
uses that you happen to call into. Or at least not without
significant overhead at runtime.

-- 
Marco



More information about the Digitalmars-d mailing list