tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
11.27k stars 286 forks source link

flag sqlite mimalloc allocator #1497

Closed MarinPostma closed 4 months ago

MarinPostma commented 4 months ago

since fragmentation is not the cause of the leak, put the sqlite mimalloc allocator behind a flag for now

sivukhin commented 4 months ago

@MarinPostma, JFYI, it seems like current implementation of allocator can cause SEGFAULT (see https://github.com/tursodatabase/libsql/pull/1486#discussion_r1647736447)

Should we fix it?

MarinPostma commented 4 months ago

Yes! Do you have a reproducer? I kinda found weird stuff this weekend but didn't have the time to investigate, so I thought I'd just disable it for now

MarinPostma commented 4 months ago

I just read the comment, I'll fix it now, but not as bad as I thought. It's almost impossible to get a system allocator return null

sivukhin commented 4 months ago

No, I just read the code for now - don't have any example with real SEGFAULT.

I just thought that fix is easy (we just need to correctly handle nullptr output from the allocator) - and it's good to do that now given that it's unclear when mimalloc will be enabled again in libsql (and by this time all of us will forget about nuances of implementation).

But if you are busy you can merge this PR and I will create fix for mimalloc bit later.

MarinPostma commented 4 months ago

done