silentbicycle / lua-sqlite

wrapper for sqlite3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory Leak

brimworks opened this issue · comments

If you call stmt:rows("_l") or stmt:rows("_t"), and you don't iterate over all elements, then the col_info * "light user data" will never be freed. I'm willing to fix this, but I don't want to bother unless your on-board with my suggested fix.

Specifically, I think the col_info* should be a full user-data rather than a light user-data so we can use Lua to do the memory allocation (and deallocation) for us.

For now I'm simply avoiding the "_l" and "_t" special cases.

Thanks,
-Brian

I'm happy to merge these once I have a chance to test them, but I haven't used this library in ages and I should probably review the whole thing for Lua 5.3 / LuaJIT compatibility and audit memory leaks with Valgrind, too.

Thanks for your time!