Making AST use Arenas #1
Notifications
Total Time Spent: 421 hours 20 minutes
laentropia
421 hours 20 minutes
No due date set.
Dependencies
No dependencies set.
Reference: laentropia/Calculator#1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Arenas
An arena is a piece of memory that you allocate, is supposed to be big and you put a lot of different data into it that you want to free at the same time
An arena can be constructed with malloc and free, you just save the pointer to the data, its size and an offset. It all kinda is like a stack and is used for preventing memory fragmentation primarily.
Why?
Well, when parsing expressions, currently, we use malloc and free as we create and evaluate the tree. A cool appliance would be instead to use an Arena to save each tree, this way we can do it in a more easy way.
How
Implementing a whole new part of the program that does the Arena, kinda like the ASTNodeArray.
Done!