Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the destruction of the objects #88

Open
rseac opened this issue Apr 7, 2020 · 1 comment
Open

Refactor the destruction of the objects #88

rseac opened this issue Apr 7, 2020 · 1 comment
Labels

Comments

@rseac
Copy link
Collaborator

rseac commented Apr 7, 2020

Description

The destruction of objects with Matchers and SystemCClang should be revisited. It seems that the destruction of dynamically objects are not done properly.

@rseac rseac added the bug label Apr 7, 2020
@rseac
Copy link
Collaborator Author

rseac commented Apr 8, 2020

The current design creates an incomplete ModuleDecl in Matchers. The ports are populated there. Then, for each instance that is recognized, a new ModuleDecl is created, and information from the incomplete ModuleDecl is copied into the new instance-specific ModuleDecl. When deleting an instance of ModuleDecl, we have to be careful. This is because we do not want to delete the instance-specific ModuleDecl, which has structures with pointers in it (PortDecl), and then delete the incomplete ModuleDecl because the latter will cause a double free memory error. This is because the deletion of the instance-specific ModuleDecl will free the objects identified in the incomplete ModuleDecl.

The current solution is to clear the information for the instance-specific ModuleDecl before deleting it. Then, the deletion of the incomplete ModuleDecl will free the other objects such as PortDecl.
clearOnlyGlobal does exactly this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant