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/json/json-free.md
Normal file
25
docs/language/json/json-free.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
id: json-free
|
||||
name: Json.free
|
||||
category: json
|
||||
kind: namespace-method
|
||||
tokens: Json.free
|
||||
sig: Json.free(value) -> void
|
||||
tip: Give back a parsed tree's nodes; its strings stay.
|
||||
order: 3
|
||||
ns: Json
|
||||
member: free
|
||||
---
|
||||
|
||||
Gives back every node and list of a tree <a href="json-parse"><code>Json.parse</code></a> made, once what it describes has been built. Ludic has no garbage collector, so a tree read and dropped is otherwise kept for as long as the program runs. The tree's strings stay, because a reader may keep a name it took out of it; when nothing was kept, <a href="json-free_all"><code>Json.free_all</code></a> gives those back too. Only for a parsed tree: one put together by hand may share a node or hold a literal.
|
||||
|
||||
```ludic
|
||||
program Free {
|
||||
entry {
|
||||
let doc = Json.parse("{\"hp\": 3}")
|
||||
let hp = value_as_int(value_get(doc, "hp"))
|
||||
Json.free(doc)
|
||||
print(hp)
|
||||
}
|
||||
}
|
||||
```
|
||||
26
docs/language/json/json-free_all.md
Normal file
26
docs/language/json/json-free_all.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
id: json-free_all
|
||||
name: Json.free_all
|
||||
category: json
|
||||
kind: namespace-method
|
||||
tokens: Json.free_all
|
||||
sig: Json.free_all(value) -> void
|
||||
tip: Give back a parsed tree whole, strings and keys included.
|
||||
order: 4
|
||||
ns: Json
|
||||
member: free_all
|
||||
---
|
||||
|
||||
<a href="json-free"><code>Json.free</code></a> and every string value and object key the parser made as well: for a reader that copied whatever it keeps (<code>s[0 .. len(s)]</code>), so the whole document goes. A text read, parsed and let go this way leaves nothing behind.
|
||||
|
||||
```ludic
|
||||
program FreeAll {
|
||||
entry {
|
||||
let doc = Json.parse("{\"name\": \"camp\"}")
|
||||
let s = value_as_str(value_get(doc, "name"))
|
||||
let name = s[0 .. len(s)]
|
||||
Json.free_all(doc)
|
||||
print(name)
|
||||
}
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue