Replies: 1 comment
-
The SyntaxTree is returned via a shared_ptr. When all shared_ptrs that reference that tree go out of scope the tree will be freed, along with all related syntax nodes. Source files that are loaded into memory are stored in the SourceManager. When the SourceManager object is destroyed all of that source text memory will be released. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm not really understanding how memory allocation is working in slang. I've read that there is a SourceManager and there are BumpAllocators, but I don't see how these are "reset", "freed" or "destroyed" per-se.
The documentation states that the SourceManager and SyntaxTree need to be "kept alive", but I'm not seeing anything describing how to kill them when needed.
Or in other words if I called "auto result = SyntaxTree::fromFile("path/to/file.sv");", and got a pointer to a SyntaxTree, I see in the API that I can get the SourceManager and the BumpAllocator for that tree.... but once I've finished with that SyntaxTree what should I be doing to correctly release its memory resources?
Thanks for your time,
Carl C.
Beta Was this translation helpful? Give feedback.
All reactions