Skip to content

Issue3345 spawn omc#4585

Open
JayHuLBL wants to merge 2 commits intomasterfrom
issue3345_spawnOMC
Open

Issue3345 spawn omc#4585
JayHuLBL wants to merge 2 commits intomasterfrom
issue3345_spawnOMC

Conversation

@JayHuLBL
Copy link
Copy Markdown
Contributor

@JayHuLBL JayHuLBL commented May 4, 2026

This closes #3345.

@JayHuLBL JayHuLBL requested a review from mwetter May 5, 2026 22:05
@JayHuLBL
Copy link
Copy Markdown
Contributor Author

JayHuLBL commented May 5, 2026

@mwetter It's ready for your review.

Copy link
Copy Markdown
Member

@mwetter mwetter left a comment

Choose a reason for hiding this comment

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

Please see inline question.

y);
}

/* Track freed objects to prevent double-free when OpenModelica calls the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@JayHuLBL : If the root cause is indeed multiple calls to free, why not simply setting the pointer to NULL as is recommended at https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/recommendations/memory-management-mem/mem01-c/

This seems much clearer than the rather convoluted tracking mechanism that this pull request would introduce.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mwetter
OpenModelica stores the external object pointer in its own runtime and then passes the same (now-freed) address again on the second destructor call.
Setting a local variable to NULL after free has no effect on that external stored value.

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.

Spawn example TwoIdenticalTwoZoneBuildings has 'process crashed' in OpenModelica

2 participants