Making AST use Arenas #1

Closed
opened 2026-03-26 19:02:31 -06:00 by laentropia · 1 comment
Owner

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.

# 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.
laentropia self-assigned this 2026-03-26 19:02:31 -06:00
laentropia added this to the Calculator project 2026-03-26 19:02:31 -06:00
laentropia moved this to To Do in Calculator on 2026-03-26 19:02:45 -06:00
laentropia moved this to In Progress in Calculator on 2026-03-26 19:36:07 -06:00
laentropia started working 2026-03-26 19:39:14 -06:00
laentropia added reference feature-AST-using-arena 2026-04-13 06:47:11 -06:00
laentropia worked for 421 hours 20 minutes 2026-04-13 08:59:15 -06:00
Author
Owner

Done!

Done!
laentropia moved this to Done in Calculator on 2026-04-13 10:31:27 -06:00
Sign in to join this conversation.