Skip to content

Instantly share code, notes, and snippets.

@toshok
Created July 14, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshok/a8edfebfe09da0d7bdaa to your computer and use it in GitHub Desktop.
Save toshok/a8edfebfe09da0d7bdaa to your computer and use it in GitHub Desktop.
--- a/src/gc/collector.cpp
+++ b/src/gc/collector.cpp
@@ -231,12 +231,16 @@ void GCVisitor::visit(void* p) {
if (!p)
return;
- if (isNonheapRoot(p)) {
- return;
- } else {
- ASSERT(global_heap.getAllocationFromInteriorPointer(p)->user_data == p, "%p", p);
+ GCAllocation* alloc = global_heap.getAllocationFromInteriorPointer(p);
+ if (alloc) {
+ ASSERT(alloc->user_data == p, "%p", p);
stack->push(p);
}
+#ifndef NDEBUG
+ else {
+ ASSERT(isNonheapRoot(p), "%p", p);
+ }
+#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment