Essentially here is what was happening: -Create C++ object -Try to point some reference to this object, but object address is suddenly 0x1 (just by doing one step in gdb) when trying to access one of it's properties. -Tried to run it with valgrind, and it works fine with valgrind, which leads me to believe it is some memory allocation issue with C++ on the heap -I modified the C++ class to have a uint64_t variable before the variable declaration. Now program works fine!
I believe the issue is probably with heap corruption at some point, when something overwrites certain addresses.Having that extra unneeded 64-bit int in the heap makes it still be valid.