rgbds
rgbds copied to clipboard
Find and fix RGBASM memory leaks
- [ ]
PURGEorREDEFof anEQUSsymbol does not free its previous string contents. - [ ] Use Bison to free memory when a token is deleted
- [ ] Files are never
unmaped if a single macro or REPT block occurred within - To be continued
Believe it or not, but you can't free an EQUS :) I tried, and it explodes with a bunch of funny colors. The main problem is an expansion deleting itself; the solution is to ref-count strings. (This overlaps with #650.)
A large chunk of the problem is the lack of cleanup when done with assembling.
Note that Bison's token destructors might help with this a bit.
ASAN is enabled, but disables checking for memory leaks for now with detect_leaks=0.
See about using an 'std::shared_ptr aliasing constructor' for dealing with string_views that preserve the lifetime of a backing std::string (or mmap or whatever).