mirror of
https://github.com/Comfy-Org/comfy-aimdo.git
synced 2026-11-04 23:37:21 +00:00
[PR #130] [CLOSED] malloc graph: do not poison the graph when a rogue candidate is freed early #131
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-aimdo#131
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-aimdo/pull/130
Author: @lonelystarCX
Created: 10/22/2026
Status: ❌ Closed
Base:
master← Head:fix/rogue-freed-not-fatal📝 Commits (2)
f9c7925malloc graph: do not poison the graph when a rogue candidate is freed early9185d8fmalloc graph: drop the no-op candidate scan in the default build📊 Changes
1 file changed (+19 additions, -0 deletions)
View changed files
📝
src/malloc-graph.c(+19 -0)📄 Description
Follow-up to #129 (full mechanism, source walk-through and runtime evidence there).
What this changes
graph_failed()no longer marks the malloc graph failed when a rogue candidate was freedbefore the root pop. Everything else is untouched:
g->failedis still set byRETURN_G_FAILED, byhandoff_rogues()returningROGUE_HANDOFF_ERROR, and by remapfailures.
Why the early free does not need to be fatal
g->rogue_candidates,rogue_va()/rogue_phys()keep its address range out of any newly planned allocation, so the compiler cannot hand the
range out again.
handoff_rogues()reports asROGUE_HANDOFF_FREEDandfinalize_rogues()handles at the root pop (it is not adopted, then scrubbed).malloc_graph_alloc/free/pause/push/pop/set_streamreturns false and callers only seeRuntimeError("aimdo memory compile error"), with no reset path.-DAIMDO_ROGUE_FREE_IS_FATALrestores the old behaviour for A/B builds.Verification
Same ComfyUI prompt, same machine,
aimdoswapped in site-packages, shipped wheel backed up:scripts/build-linux-aimdo.sh)SelfLiftAvatarH3Samplerwithaimdo memory compile error(545 s)1312x736 HEVC 24 fps + AAC 32k stereo, 10.125 s(17 min 09 s)src/malloc-graph.c)The unpatched row matters: the local rebuild reproduces the defect, so the passing row is not
an artifact of building from source.
Caveats, for a fair review
graph breaks: 21, rogues: 235(the fatal one had 9 / 154) — thegraph keeps living with more severed ranges. Whether those fenced ranges should eventually be
recycled (rather than held for the graph's lifetime) is your call.
run
finalize_rogues()at every pop, or exposemalloc_graph_reset()so a caller canrecreate the graph instead of failing the prompt.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.