Os.heap_bytes: the heap without the renderer; string_temps reads it
Vk.heap_bytes pulled the Vk module - and on lang/uifree the GL window path - into a plain program, which then failed to link (_cgl_offscreen, lgl_GetError). Os.heap_bytes is malloc_zone_statistics through a weak reference (0 where there is none, and on Windows). Reseeded. Docs for it and for Json.free / Json.free_all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1adce5b58b
commit
22d1e2d66a
10 changed files with 33227 additions and 33008 deletions
25
docs/language/os/os-heap_bytes.md
Normal file
25
docs/language/os/os-heap_bytes.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
id: os-heap_bytes
|
||||
name: Os.heap_bytes
|
||||
category: os
|
||||
kind: namespace-method
|
||||
tokens: Os.heap_bytes
|
||||
sig: Os.heap_bytes() -> long
|
||||
tip: malloc's live bytes (macOS; 0 elsewhere).
|
||||
order: 19
|
||||
ns: Os
|
||||
member: heap_bytes
|
||||
---
|
||||
|
||||
The bytes malloc holds live across every zone of the process, on macOS; 0 on other platforms. Ludic has no garbage collector, so a path that runs every frame must give back all it takes: read this before and after many rounds of it, and the difference is what it keeps. A test built on it should allow for 0 elsewhere.
|
||||
|
||||
```ludic
|
||||
program Heap {
|
||||
entry {
|
||||
let before = Os.heap_bytes()
|
||||
var n = 0
|
||||
for i in 0 .. 1000 { if `{i}` == "7" { n += 1 } }
|
||||
print(Os.heap_bytes() - before)
|
||||
}
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue