Open CausticKirbyZ opened 1 week ago
Ahh, yep, I used GC.free
instead of LibC.free
. I had this fixed locally, but hadn't yet committed it. I had to step away from working on this shard because the underlying Kuzu library had just made a bunch of changes to its C API but hadn't yet cut a release with those changes, so I was working against a snapshot of code I wasn't confident was stable.
I fixed this part in d75d36e, though.
if you comment out the kuzu.cr lib line that causes the compiler error the resulting compiled binary crashes in the above loop
This does reproduce locally for me. This was caused by my confusion around the out
keyword in Crystal and seeing memory usage increasing over time. I assumed I wasn't freeing memory. It seems like Crystal does free memory allocated by out
, though — I can't imagine another reason we'd be seeing that double-free
error here. I'm still not sure about it, though. I need to look more into it.
I updated my code for the changes you made. it is now triggering a runtime error of free(): invalid pointer
when running a query that returns data. Im not sure if this ties into the double free method you mentioned. but wanted to provide update/provide more info.
Once the program hits this point the program becomes unresponsive and even trying to kill via SIGKILL is extremely delayed.
When trying to use the client's query function, the macro expands to use the incorrect pointer type.
compiler command:
crystal build kuzu_test.cr -p
compiler error:system: Arch Linux kuzu version: 0.6.0.2 (self compiled) crystal version: 1.13.2 kuzu shard installed with shards.yml and
shards install
test crystal code:happy to supply more info if needed.