q/lib/mem/alloc_unix.q

12 lines
181 B
Plaintext

import sys
alloc(length int) -> []byte {
x := sys.mmap(0, length+8, prot.read|prot.write, map.private|map.anonymous)
if x < 0x1000 {
return x
}
[x] = length
return x + 8
}