Skip to content

Reallocate LHS for allocatable strings #192

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

certik
Copy link
Contributor

@certik certik commented Mar 2, 2022

No description provided.

@certik
Copy link
Contributor Author

certik commented Mar 3, 2022

The basic use case was fixed in #194, here we need to implement proper reallocation to actually free the memory correctly to fix all leaks.

@certik
Copy link
Contributor Author

certik commented Mar 3, 2022

I think the way to do this initially is to have the tmp llvm value to "own" the data and if it is allocatable, it must release it. Constant strings must always be copied, so that they can be destroyed.

Later, we can add optimizations to this scheme: each expression would have a tag if it owns the string or not. If it owns it and it's an expression, then "it goes out of scope" and must be deallocated. If it does not own it, then deallocation doesn't take place. I think we know at compile time who owns what.

@czgdp1807
Copy link
Collaborator

I think we need to work on this. @certik

@certik certik marked this pull request as draft December 23, 2022 23:53
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