Bug 13691 – Add @nogc at the top of system modules like core.sys.linux.sys.mman

Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-11-06T02:53:18Z
Last change time
2020-01-16T14:21:43Z
Assigned to
No Owner
Creator
Marco Leise

Comments

Comment #0 by Marco.Leise — 2014-11-06T02:53:18Z
Trivial, but I thought I'd write it down as a formal bug report to be able to refer to it in my code comments. There is Phobos @nogc code, which usually means "no heap activity" and there is @nogc code that just manages memory differently and often relies on system functions, which are not yet marked @nogc. E.g. I found that with madvise(..., MADV_DONTNEED) you can quickly reset memory blocks to all-zeros and free up the resident memory pages again.
Comment #1 by pro.mathias.lang — 2020-01-16T14:21:43Z
`@nogc` had been added to most (hopefully all?) `extern(C)` binding. I checked `madvise` and it is annotated nowadays: https://github.com/dlang/druntime/blob/d3eca11d43f1ef57cadb2f724ac51a6b0a437a65/src/core/sys/posix/sys/mman.d#L47