Hey, I need some help debugging a hxcpp GC crash. I am pretty sure it's my own fault, as I'm using a not-quite standard build setup, but I'm kind of running out of things to try.
This is using luxe on apple tvOS, and I'm semi-manually adding all the hxcpp runtime and generated cpp files to my xcode project, but as far as I can tell my build flags and defines match a regular hxcpp build. If I build for desktop (using flow, not my project), everything works OK, so I don't think it's a hxcpp problem, but I'm just not sure how to figure out where my build differs.
What happens: Intermittently -- right now this happens often -- I will get a crash (bad access) in Array.h/cpp. This usually happens in a ArrayBase::Realloc, at the point where where it's trying to call GetElementSize, but it happens in a few other places too (often obj->__Mark). Looking at the stack trace and the debugger, it looks like the vtable is messed up, it's trying to call a virtual function but the address in the vtable is 0x1010101010101, which my guess is a scribble value that something is setting to mark deleted memory (?). So it looks like some hx::Object is getting deleted or reset, but it's still trying to use it. Or something?
I'm not too familiar with the inner workings of the GC itself. I tried turning on some of the debug defines like SHOW_MEM_EVENTS but nothing seems obviously wrong. If I put a 'return' at the top of Collect in Immix.cpp, so it just never frees any memory, and it runs fine like that (until it eventually runs out of memory of course).
Any ideas or tips about how to debug this?
void *vtbl = ((void**)inObject)[0];
void *vt0 = ((void**)vtbl)[0];
if (vt0 == (void*)0x0101010101010101) {
printf("pushObj::BAD OBJ: %p %p %p\n", inObject, vtbl, vt0 );
}