Skip to content

fix: free ABC netlist and strings after each simplification - #679

Merged
joern274 merged 1 commit into
emsec:masterfrom
horhulenko:fix/abc-simplification-leak
Nov 5, 2026
Merged

joern274 merged 1 commit into
emsec:masterfrom
horhulenko:fix/abc-simplification-leak

Conversation

@horhulenko

Copy link
Copy Markdown
Contributor

Every simplify() call made a copy of ABC's result in translate_from_abc() and never deleted it, about 376 KB each time. A few small strings went the same way. Now they are freed, like ABC's own Verilog writer does.

The mutex in abc_simplification() is now a std::lock_guard, because one failed simplification used to keep it locked and freeze the next one.

Memory leaked, measured with LeakSanitizer

before after
1000 simplify() calls from Python 376MB 0
runTest-boolean_function 22MB 0
runTest-solve_fsm 14MB 0

This touches the same lines as #677, so whichever lands second needs a small rebase.
image

@joern274 joern274 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@joern274
joern274 merged commit 7435877 into emsec:master Nov 5, 2026
5 checks passed
SimonKlx added a commit that referenced this pull request Nov 5, 2026
Picks up the ABC simplification leak fix (#679) and the follow-up fixes from its review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants