You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 2, 2020. It is now read-only.
In the current subleqc source code, stacks and buffers require their memory to be micro-managed. While allocations are automatically handled by the Push() (for stack) and Append() (for buffer) functions, stacks and buffers still require their memory to be manually freed by calling their respective Empty() functions, which perform the operation of deleting their allocated pointers.
This means the code is cluttered with some strangely placed Empty() calls that don't contextually or semantically make sense unless you already know that Empty() frees the memory allocated to the stack or buffer. Additionally, calling Empty() does a lot of extra work that isn't necessary when a stack or buffer is going out of scope and doesn't need that extra work to be done.
Another problem is that I've been lazy and haven't populated the code with nearly enough Empty()s. This means that the assembler is loaded with memory leaks. Harmless memory leaks, but they're still there and should be eradicated.
There are two options I see to fixing this:
Give stacks and buffers destructors that delete allocated memory when they fall out of scope, OR
Create a function whose sole purpose is to free allocated memory so that we have a function to call that frees the memory and does nothing else.