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.

Note
Medium Risk
Adds frequent heap validation and
abort()on suspected corruption during GC, thread inheritance, and global tracing; this can impact performance and may terminate processes if the checks false-positive or trigger in production.Overview
Adds aggressive heap-integrity validation to GC-critical code paths. Introduces
validate_heap_objects()(plus basic bad-pointer/type/freed-bit checks) and calls it at multiple stages oflocal_collection(), before/after heap object transfer inluaC_inherit_thread(), and at the start oftrace_heap().Also moves deferred finalization (
finalize_deferred()) to run before unblocking the collector during local GC, with additional validation checkpoints before/after reclaiming and freeing deferred objects.Written by Cursor Bugbot for commit 53b84ba. This will update automatically on new commits. Configure here.