Repository navigation
Hybrid: a second solve in the same process sets up its own output - #33
Merged
Merged
Conversation
cmdVCellWriteOutput collected the vcellWriteOutput block and parsed it into the VCellSmoldynOutput once per process, guarded by a function-level static. smoldynInit creates a new VCellSmoldynOutput for every hybrid run, so the second solve's output was never parsed and computeHistogram dereferenced its null output arrays (EXC_BAD_ACCESS in VCellSmoldynOutput::computeHistogram, called from SimTool::start1). cmdVCellDataProcess kept the same kind of state. That state now lives on the VCellSmoldynOutput, so each run starts clean. Fixes #23. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23.
Cause. Under lldb, the second
pyvcell_fvsolver.solve()on hybrid inputs stops withEXC_BAD_ACCESS (address=0x0)inVCellSmoldynOutput::computeHistogram(), called fromSimTool::start1(). The sequence:smoldynInitcreates a newVCellSmoldynOutputfor every hybrid run.parseInput.cmdVCellWriteOutputcallsparseInputonly once per process, behind a function-levelstatic bool firstTime, and collects the block's lines in astatic stringstream.computeHistogramreads its null arrays.cmdVCellDataProcesskeeps the same kind of state in statics.Fix. That state now lives on the
VCellSmoldynOutput:outputInputParsed,outputInput,dataProcessInputParsed,dataProcessInputanddataProcName. Each run starts clean. The standalonesmoldyn_x64executable runs one simulation per process, so its behaviour is unchanged.Verified (macOS arm64, cp312-abi3 wheel built from this branch):
Not changed: leftover cleanup. The hybrid path never calls
vcellhybrid::smoldynEnd, so the Smoldynsimand the previousVCellSmoldynOutputleak once per solve. That costs memory but is harmless here. Freeing them needs~VCellSmoldynOutputto stop dereferencing the freedsmoldynSim, which is better left to a separate change.🤖 Generated with Claude Code