fix(render3d, runtime): a glTF document is freed whole, layouts found by number, block records reused

- Json.free_all (value_free_all): a parsed tree's nodes, lists and strings. render3d frees each
  glTF document that way at the next load; the names kept out of it are copies (a primitive's
  material, a skin's joints, an animation clip's name in ludic.anim) - a model's strings were
  ~640 KB left behind per load
- jp_number made a digits list per decimal in a document and never freed it
- gvk_layout_id matches a mesh's layout as numbers in a scratch made once, against the layouts
  known end to end; a new mesh no longer builds a key string
- gvk_mem_new puts a new block into the record of one given back rather than appending, so a
  buffer made again every few frames no longer grows the block lists

steady.ludic adds a glTF parsed and freed whole 200 times: 0 bytes (38,400 before the digits fix),
beside the buffer path and the frame, still 0. A model loaded and let go still keeps ~2 KB a round
(texture and buffer handles are not reused yet); it is bounded at 8 KB a round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 11:36:42 +03:00
parent 866037a0d7
commit a465984c52
9 changed files with 114 additions and 16 deletions

View file

@ -202,6 +202,11 @@ export state Render3dState {
gvk_nopool: bool = false
gvk_bc_said: int = 0 # attachments refused for being compressed, said so far
gvk_map_slot: []pointer = null # gvk_mem_new's mapped-pointer slot, made once
gvk_lay_sig: words = null # gvk_layout_id's scratch: one layout as numbers
gvk_lay_seen: words = null
gvk_lay_flat: []int = null # every layout known, end to end; gvk_lay_off / _len find each
gvk_lay_off: []int = null
gvk_lay_len: []int = null
gvk_has_bc: bool = false # textureCompressionBC: .dds textures are uploaded compressed
# R3D_VK_PROF: Vulkan objects made and destroyed, reported every 120 frames
gvk_mk_img: int = 0
@ -331,7 +336,6 @@ export state Render3dState {
gvk_n_flush: int = 0
gvk_prof_frames: int = 0
gvk_n_pipe_new: int = 0 # pipelines made this profile window
gvk_layout_keys: []string = null
gvk_pc_prog: []int = null
gvk_pc_layout: []int = null
gvk_pc_state: []int = null