Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
dmd.nogc
Checks that a function marked @
nogc
does not invoke the Garbage Collector.
Specification No-GC Functions
Authors:
License:
Source nogc.d
Documentation https://dlang.org/phobos/dmd_nogc.html
- class
NOGCVisitor
: dmd.visitor.StoppableVisitor; - Look for GC-allocations
- bool
setGC
(FuncDeclarationfd
, Locloc
, const(char)*fmt
, RootObject[]args
...); - The function is doing something that may allocate with the GC, so mark it as not nogc (not no-how).Parameters:
FuncDeclaration fd
function Loc loc
location of GC action const(char)* fmt
format string for error message. Must include "%s %s" for the function kind and name. RootObject[] args
arguments to format string Returns:true if function is marked as @nogc, meaning a user error occurred - bool
setGCCall
(FuncDeclarationfd
, FuncDeclarationf
); - The function calls non-@nogc function f, mark it as not nogc.Parameters:
FuncDeclaration fd
function doin the call FuncDeclaration f
function being called Returns:true if function is marked as @nogc, meaning a user error occurred
Copyright © 1999-2025 by the D Language Foundation | Page generated by
Ddoc on Sun Apr 13 05:29:17 2025