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

Suggestion: Add error or warning if no @pool (or equivalent) when temporary allocator is used. #2002

Open
joshring opened this issue Feb 27, 2025 · 3 comments
Milestone

Comments

@joshring
Copy link
Contributor

joshring commented Feb 27, 2025

Observation: Common feedback I see on C3 code is that there are many memory leaks.
Goal: Promote the temporary allocator by making it a default choice in C3 0.7

Complimentary to that goal and observation may be detecting if there is a @pool(){} (or equivalent) in the context where the temporary allocator was used. This may then prompt people to the solution via an error or warning fix the memory leak issue, leading to a nice quality of life improvement.

@alexveden
Copy link
Contributor

Cool idea.

BTW, what if this @pool would initialize temp allocator engine internally too if it wasn't initialized before? Therefore, we might get rid of tmem() macro, in favor of tmem built-in (because all initialization mechanics will be in @pool call)

@lerno
Copy link
Collaborator

lerno commented Feb 27, 2025

That would prevent giving a nice error on trying to use the temp allocator outside of a @pool

@lerno
Copy link
Collaborator

lerno commented Mar 10, 2025

Note that 0.7.0 is already moving towards a temp-alloc-by-default use.

@lerno lerno added this to the 0.7.0 milestone Mar 11, 2025
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

No branches or pull requests

3 participants