Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find and fix RGBASM memory leaks #709

Closed
3 tasks done
Rangi42 opened this issue Jan 21, 2021 · 4 comments · Fixed by #1381
Closed
3 tasks done

Find and fix RGBASM memory leaks #709

Rangi42 opened this issue Jan 21, 2021 · 4 comments · Fixed by #1381
Labels
bug Unexpected behavior / crashes; to be fixed ASAP! rgbasm This affects RGBASM
Milestone

Comments

@Rangi42
Copy link
Contributor

Rangi42 commented Jan 21, 2021

  • PURGE or REDEF of an EQUS symbol 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
@ISSOtm
Copy link
Member

ISSOtm commented Jan 21, 2021

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.

@ISSOtm ISSOtm added bug Unexpected behavior / crashes; to be fixed ASAP! rgbasm This affects RGBASM rgblink This affects RGBLINK labels Feb 10, 2021
@ISSOtm
Copy link
Member

ISSOtm commented Apr 19, 2021

Note that Bison's token destructors might help with this a bit.

@Rangi42
Copy link
Contributor Author

Rangi42 commented May 2, 2021

ASAN is enabled, but disables checking for memory leaks for now with detect_leaks=0.

ISSOtm added a commit that referenced this issue May 3, 2021
At least all that were reported in the tests.
Partial fix for #709, that only leaves RGBASM to be fixed... oh boy!
@Rangi42 Rangi42 removed the rgblink This affects RGBLINK label May 3, 2021
@Rangi42 Rangi42 changed the title Find and fix memory leaks Find and fix RGBASM memory leaks May 3, 2021
@Rangi42 Rangi42 added this to the v1.0.0 milestone May 5, 2021
@Rangi42 Rangi42 modified the milestones: v1.0.0, v0.7.1 Mar 22, 2024
@Rangi42
Copy link
Contributor Author

Rangi42 commented Mar 22, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior / crashes; to be fixed ASAP! rgbasm This affects RGBASM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants