fix(leaks): what play allocated every frame and never freed - a shadow uniform's name, the Tick, a ridden vehicle's moves
Found with malloc_history over 1200 frames of play without the interface (the first Ludic function on each allocating stack, live bytes at two marks): sh_loc built `name + "[0]"` per program per pass per frame - 24.6 MB of 33 in the window; its callers pass both names as literals now. tick_set fills the frame loop's one Tick instead of tick_new making one a frame. A ridden boat or horse said VEHICLE_MOVED as a new fact every frame; the metres are added up in VehiclesState and taken once (vehicle_moved_take / _kind / _x / _z). Play's growth without the interface: 92 -> 14.7 MB a minute (maroon-lake tests/leakcheck.sh); what is left is phys_push (Physics' fix on lang/nav) and the HUD's strings. Packages 407, ludic-dev test 305 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8fbb1f7d03
commit
231715bf98
9 changed files with 47 additions and 10 deletions
|
|
@ -236,7 +236,9 @@ program VehiclesTest {
|
|||
vehicle_mount(vehicles_st, h)
|
||||
ride(physics_st, vehicles_st, 0.0, 1.0, false, 3.0)
|
||||
expect_near(h.speed, 4.5, 0.05)
|
||||
expect(count(facts(vehicles_st), VEHICLE_MOVED) > 100)
|
||||
expect(vehicle_moved_take(vehicles_st) > 10.0) # 3 s at 4.5 m/s, added up
|
||||
expect_eq(vehicle_moved_kind(vehicles_st), VEHICLE_HORSE)
|
||||
expect_near(vehicle_moved_take(vehicles_st), 0.0, 0.0001)
|
||||
ride(physics_st, vehicles_st, 0.0, 1.0, true, 3.0)
|
||||
expect_near(h.speed, 11.0, 0.1)
|
||||
expect(h.fuel < 100.0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue