feat(ludic.physics): Jolt's heap counted in the shim (plan 25) - jph_heap_bytes/peak/allocs, phys_heap_bytes/peak/allocs
Jolt's Allocate/Reallocate/Free/AlignedAllocate/AlignedFree go to libc's malloc with the size in a 16-byte header, and atomic counters keep live bytes, the peak and the blocks asked for (its job threads allocate too). The fence reads the three exports extern_weak to judge Jolt by its plateau. jolt_heap_test: a ground in and out 1100 times holds 46,482,514 bytes after the first 100 and after all of them, the peak does not move, and a closed world gives back every byte it took. The macOS library is rebuilt; the Windows DLL still has to be rebuilt on the PC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7fdd6582be
commit
e9de2b6f27
5 changed files with 115 additions and 4 deletions
|
|
@ -45,3 +45,10 @@ extern function jph_body_angular_impulse(w: pointer, id: int, x: float, y: float
|
|||
extern function jph_body_spin(w: pointer, id: int, out: pointer) -> void = "jph_body_spin"
|
||||
extern function jph_body_set_pose(w: pointer, id: int, x: float, y: float, z: float, qx: float, qy: float, qz: float, qw: float, vx: float, vy: float, vz: float) -> void = "jph_body_set_pose"
|
||||
extern function jph_shape_heightfield_bspline(tex: pointer, n: int, ox: float, oz: float, cell: float) -> pointer = "jph_shape_heightfield_bspline"
|
||||
extern function jph_heap_bytes() -> long = "jph_heap_bytes"
|
||||
extern function jph_heap_peak() -> long = "jph_heap_peak"
|
||||
extern function jph_heap_allocs() -> long = "jph_heap_allocs"
|
||||
# what Jolt holds now, the most it has held, and the blocks it has asked for (counted in the shim)
|
||||
export function phys_heap_bytes() -> long { return jph_heap_bytes() }
|
||||
export function phys_heap_peak() -> long { return jph_heap_peak() }
|
||||
export function phys_heap_allocs() -> long { return jph_heap_allocs() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue