Conversation
There was a problem hiding this comment.
Pull request overview
Adds new heap integrity validation to detect GC heap corruption and abort early, integrated into key GC lifecycle points and global tracing to surface memory/list corruption issues closer to their source.
Changes:
- Introduces
validate_heap_objects(lua_State *L, const char *where)to walkL->heap->objectsand validate node pointers/type/ownership, aborting on failure. - Calls this validation before/after heap transfer in
luaC_inherit_thread()and at multiple stages oflocal_collection(). - Adds basic corruption checks inside
trace_heap()during global tracing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Note
High Risk
Touches core GC/heap management paths by adding frequent integrity checks and changing the ordering of deferred finalization, which could impact performance and GC behavior. New hard
abort()s on detected corruption can crash production if checks fire (including due to false positives).Overview
Adds a heap integrity validation layer for the GC object TAILQ, including pointer/type/owner checks and detailed crash logging via
tailq_abort().Wires these validations into hot GC/heap mutation points: object allocation (
new_obj), thread heap transfer (luaC_inherit_thread), local GC phases (local_collectionat multiple checkpoints), and global tracing (trace_heap). It also reordersfinalize_deferred()to run while the collector is still blocked, with extra validation before/after finalization and deferred frees.Written by Cursor Bugbot for commit 6044429. This will update automatically on new commits. Configure here.