acdream/tests/AcDream.App.Tests/Rendering
Erik 119a2326be fix(#193): clear InstanceGroup.Opacities each frame — stop the ~1 GB/min LOH leak
Root cause (measured, not guessed): the OOM was a MANAGED Large-Object-Heap leak
(~5 GB in 6 min of roaming; working set 1.6 GB -> 7.6 GB), dominated by ~3.8 GB of
live System.Single[]. A heap-retention analysis of a captured gcdump traced 241 of
242 giant float arrays to a single List<float>: WbDrawDispatcher.InstanceGroup.Opacities.

#188 (2026-07-09, fading doors) added Opacities as a 5th per-instance parallel list
alongside Matrices/Slots/LightSets/IndoorFlags, but left it out of the per-frame
clear loop (WbDrawDispatcher.cs:959). So Opacities.Add(1.0f) fired once per drawn
instance per frame and the list never reset — growing forever; List<float> capacity
doubling produced the observed ~128 MB / ~512 MB power-of-two arrays and OOM after
~50 min. Hit both UI builds because it's core render, and started only recently
because Opacities did not exist before #188.

Fix: extract the per-frame reset into InstanceGroup.ClearPerInstanceData() (promoted
InstanceGroup private->internal) that clears ALL FIVE parallel lists in one place, so
a future 6th list can't silently drift out of the frame lifecycle again. Line 959 now
calls it. TDD: InstanceGroupClearTests asserts every parallel list resets (RED with
the old 4-list clear, GREEN after adding Opacities.Clear()).

Static-audit note: this is exactly why we measured before fixing — the audit ranked
GlobalMeshBuffer (GPU) #1 and the entity-dict leak #3; both were wrong about the
dominant cause. The dotnet-counters (managed vs native) + gcdump retention graph
named the real one-line culprit.

Secondary (NOT this commit): _groups dictionary is never pruned (bounded by distinct
group keys, empty groups are cheap) — filed as a follow-up, not the multi-GB driver.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 14:15:10 +02:00
..
Wb fix(#193): clear InstanceGroup.Opacities each frame — stop the ~1 GB/min LOH leak 2026-07-10 14:15:10 +02:00
CameraCollisionIndoorTests.cs T6 (BR-7) C3: per-cell shadow architecture - flood registration, building channel, per-cell query; b3ce505 stopgap DELETED (closes #99) 2026-06-11 14:37:50 +02:00
CameraCollisionUpdateViewerTests.cs feat(A): wire SweepEye to the verbatim update_viewer (start-cell + fallbacks) 2026-06-05 11:10:32 +02:00
CameraControllerTests.cs feat(camera): InputAction + DebugVM surface for retail chase camera 2026-05-18 20:04:34 +02:00
CellViewDedupTests.cs feat(render): indoor render WORKS — terminating portal flood + every-cell seal + look-in FPS 2026-06-07 10:14:43 +02:00
CellVisibilityFromRootTests.cs refactor(render): Stage 3 T3.1 — delete FindCameraCell AABB grace-frame fallback 2026-06-02 15:36:47 +02:00
CellVisibilityPortalPolygonsTests.cs fix(render): Phase U.2b — resolve reciprocal portal by other_portal_id (retail 433557) 2026-05-30 16:56:00 +02:00
ClipFrameAssemblerTests.cs feat(render): indoor render WORKS — terminating portal flood + every-cell seal + look-in FPS 2026-06-07 10:14:43 +02:00
ClipFrameLayoutTests.cs feat(render): Phase U.3 — GPU clip-plane gate (gl_ClipDistance), no-clip default 2026-05-30 17:27:30 +02:00
ClipPlaneSetTests.cs feat(render): indoor render WORKS — terminating portal flood + every-cell seal + look-in FPS 2026-06-07 10:14:43 +02:00
CornerFloodReplayTests.cs fix(#186): render side-cull mis-sided thin connectors — use dat PortalSide bit, not AABB centroid 2026-07-08 15:06:33 +02:00
DollCameraTests.cs fix(D.2b): Slice 2 — retail-exact doll pose, camera + heading (visual gate) 2026-06-25 13:16:27 +02:00
DollEntityBuilderTests.cs feat(D.2b): Slice 2 — DollEntityBuilder (player Setup+ObjDesc -> doll WorldEntity) 2026-06-23 09:07:02 +02:00
EntityClipTests.cs fix(render): R1 — repurpose the ParentCellId==null cell-gate bypass (#78) 2026-06-02 20:10:26 +02:00
HouseExitWalkReplayTests.cs #118: outdoor dynamics draw in the outside stage under interior roots - the house-exit clip+vanish was the SEAL z-killing the player 2026-06-11 16:49:29 +02:00
IndoorDrawPlanTests.cs feat(render): IndoorDrawPlan.ShellPass — every visible cell, no drawable filter (R1) 2026-06-06 21:59:26 +02:00
InteriorEntityPartitionTests.cs T1 (fused BR-2/3): retail frame order - dynamics last, punch+seal, shell chop deleted 2026-06-11 11:16:27 +02:00
Issue95DungeonFloodDiagnosticTests.cs test(#95): headless dungeon-flood diagnostic — measure visible-cell count on 0x0007 2026-06-13 18:52:00 +02:00
Issue113DrawingBspFilterTests.cs fix(render): #113 root cause #2 - GfxObj meshes draw only DrawingBSP-referenced polys (the REAL phantom staircase) 2026-06-10 20:52:52 +02:00
Issue113MeetingHallFloodTests.cs fix(#186): render side-cull mis-sided thin connectors — use dat PortalSide bit, not AABB centroid 2026-07-08 15:06:33 +02:00
Issue120ReciprocalPingPongTests.cs #119-residual: tower-ascent harness pins the roof-lip flood gap; barrel claim RETRACTED (user axiom: not in retail) 2026-06-11 18:34:45 +02:00
Issue124LookInSeedRegionTests.cs fix #124: interior-root building look-ins as a landscape-stage sub-pass 2026-06-12 15:59:29 +02:00
Issue127FloodFlipReplayTests.cs close #127 (user-gated + desk pin): distant-building flood flap died with the W=0 clip port 2026-06-13 10:03:33 +02:00
Issue129PunchBiasTests.cs fix #129: cap the punch mark bias's eye-space reach (was unbounded at distance) 2026-06-12 13:38:59 +02:00
Issue130DoorwayStripTests.cs fix #130 (the real strip): drawn-shell lift vs draw-space portal consumers 2026-06-12 14:28:16 +02:00
Issue131SetupProbeTests.cs fix #131 (root cause 4, structurally forced): look-in cells draw their DYNAMICS - the town portal is a server object in the hall's porch cell 2026-06-12 20:52:34 +02:00
Issue177StairDescentCameraFloodTests.cs park #177: retail cdb trace DISPROVES the portal-flood theory 2026-07-07 08:43:21 +02:00
Issue181CameraParkStabilityTests.cs diag #181: root-cause chain complete - flapping cell 0x0181, wall-press excitation, and the REAL defect: camera-flood-scoped light application 2026-07-06 21:04:34 +02:00
Issue181VisFlapReplayTests.cs diag #181 (refined): 0x0181's region is a zero-area sliver; the amplifier is per-drawn-cell state shifting with the cell list, not light-pool scoping 2026-07-06 21:46:49 +02:00
Issue181WallPressEquilibriumTests.cs port #181: retail viewer step subdivision (calc_num_steps 0x0050a0b0) - radius-anchored steps + remainder final step + viewer-exempt small-offset abort 2026-07-06 22:30:37 +02:00
Issue176177FacilityHubFloodReplayTests.cs docs+test #176/#177: 12 mechanisms refuted, apparatus shipped, probe protocol staged 2026-07-05 21:20:03 +02:00
NdcScissorRectTests.cs fix #130: doorway-slice scissor cut the aperture's top/right pixel row 2026-06-12 13:31:43 +02:00
OutdoorCellNodeTests.cs feat(render): R-A2 — per-building floods (the flap fix) 2026-06-08 18:44:43 +02:00
PhysicsCameraCollisionProbeTests.cs feat(A): wire SweepEye to the verbatim update_viewer (start-cell + fallbacks) 2026-06-05 11:10:32 +02:00
PortalProjectionTests.cs knife-edge port: polyClipFinish W=0 eye-plane clip + degenerate-view propagation; EyeInsidePortalOpening rescue DELETED 2026-06-11 21:44:23 +02:00
PortalViewTests.cs feat(render): Phase A8.F — ViewPolygon + CellView clip-region data model 2026-05-29 11:30:28 +02:00
PortalVisibilityBuilderTests.cs knife-edge port: polyClipFinish W=0 eye-plane clip + degenerate-view propagation; EyeInsidePortalOpening rescue DELETED 2026-06-11 21:44:23 +02:00
PortalVisibilityRobustnessTests.cs feat(render): R-A2 — per-building floods (the flap fix) 2026-06-08 18:44:43 +02:00
RetailChaseCameraTests.cs fix #180: port retail's stateful camera sought-position - the sweep target converges onto the wall contact 2026-07-06 16:49:01 +02:00
ScreenPolygonClipTests.cs feat(render): Phase A8.F — ScreenPolygonClip 2D convex-polygon intersection 2026-05-29 11:37:30 +02:00
TerrainCullOrientationTests.cs fix #108-residual (root cause): terrain drew DOUBLE-SIDED - port retail landPolysDraw eye-side gate as terrain backface cull 2026-06-12 22:05:31 +02:00
TowerAscentReplayTests.cs #119-residual ROOT CAUSE: the +0.02 m render lift leaked into the portal-visibility graph - horizontal portals side-culled anyone standing on them 2026-06-11 19:26:06 +02:00