Skip to content

luajit: new gc#97

Draft
RaphaelIT7 wants to merge 3 commits intomainfrom
luajit-gc-update
Draft

luajit: new gc#97
RaphaelIT7 wants to merge 3 commits intomainfrom
luajit-gc-update

Conversation

@RaphaelIT7
Copy link
Copy Markdown
Owner

@RaphaelIT7 RaphaelIT7 commented Oct 26, 2025

WIP

The current idea:
Implement a reference counter used for gc instead of using tri-color.
Though this means to basically go through every piece of code that uses TValue or a GC object and check/adjust it as having a reference leak would be chaos.
I may change the entire approach later, as it does seem utterly painful/difficult to do, just gonna try different things and see

ToDo:

  • Properly increment/decrement the reference counter
  • Implement code into the GC for removal of objects that have a counter of 0
  • Improve implementation to reach the point of not relying on the tri-color gc and possibly removing that

Always open for ideas/feedback though remember, this is still wip and in its early stages

@RaphaelIT7 RaphaelIT7 self-assigned this Oct 26, 2025
@RaphaelIT7 RaphaelIT7 added the enhancement New feature or request label Oct 26, 2025
@RaphaelIT7 RaphaelIT7 force-pushed the main branch 4 times, most recently from 3c6136a to d279f42 Compare October 28, 2025 12:13
@Zvbhrf
Copy link
Copy Markdown
Contributor

Zvbhrf commented Oct 28, 2025

What improvements new gc brings? Can it fix Vectors and Angles not being cleaned up if you create tons of them?

@RaphaelIT7
Copy link
Copy Markdown
Owner Author

What improvements new gc brings? Can it fix Vectors and Angles not being cleaned up if you create tons of them?

iirc they are cleaned up, though not instantly or is there an existing memory leak with them?
With the reference counters, it could delete them instantly instead of leaving them for a while.

@RaphaelIT7 RaphaelIT7 force-pushed the main branch 3 times, most recently from 822fda3 to 341d27f Compare October 28, 2025 12:43
@Zvbhrf
Copy link
Copy Markdown
Contributor

Zvbhrf commented Oct 28, 2025

is there an existing memory leak with them?

Facepunch/garrysmod-issues#5397

@RaphaelIT7
Copy link
Copy Markdown
Owner Author

Huh, totally forgot about that

@RaphaelIT7 RaphaelIT7 force-pushed the main branch 17 times, most recently from db77105 to 49d88d6 Compare October 29, 2025 19:15
@RaphaelIT7 RaphaelIT7 force-pushed the main branch 25 times, most recently from bb5eb9d to 9e8cdce Compare October 30, 2025 05:40
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@RaphaelIT7
Copy link
Copy Markdown
Owner Author

RaphaelIT7 commented Mar 20, 2026

Disliked my old attempt- so I'll restart and just try to implement the 3.0 GC
-> https://github.com/tarantool/tarantool/wiki/LuaJIT-3.0-new-Garbage-Collector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants