3 ms·
So... if I'm understanding correctly, you're accessing released memory? How is this anything but undefined behaviour?
by hoseja 6y ago
So... if I'm understanding correctly, you're accessing released memory? How is this anything but undefined behaviour?
- jabl 6y agoIf I understand correctly, sqlite3VdbeMemRelease doesn't free pMem nor pMem->flags, just some other fields in the pMem struct.
- KMag 6y agoYou're almost certainly reading that correctly, that pMem is a pointer to a pointer to a block of memory, plus some metadata for that block of memory, and sqlite3VdbeMemRelease either releases the memory back to the application-level pool, frees it back to the memory allocator (glibc malloc/jremalloc/tcmalloc/dmaloc/etc.), or directly brk()/mummap()s it directly back to the OS. I have no experience with sqlite internals, but it's pretty clearly doing some application-level accounting on top of the normal memory management.
- hoseja 6y agoSo... apparently I'm not understanding correctly haha.