mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
memroot improvement: fix savepoint support
savepoint support was added a year ago as get_last_memroot_block() and free_all_new_blocks(), but it didn't work and was disabled. * fix it to work * instead of freeing the memory, only mark blocks free - this feature is supposed to be used inside a loop (otherwise there is no need to free anything, end of statement will do it anyway). And freeing blocks inside a loop is a bad idea, as they'll be all malloc-ed on the next iteration again. So, don't. * fix a bug in mark_blocks_free() - it doesn't change the number of blocks
This commit is contained in:
@@ -60,6 +60,14 @@ typedef struct st_mem_root
|
||||
PSI_memory_key psi_key;
|
||||
} MEM_ROOT;
|
||||
|
||||
typedef struct st_mem_root_savepoint
|
||||
{
|
||||
MEM_ROOT *root;
|
||||
USED_MEM *free;
|
||||
USED_MEM *used;
|
||||
unsigned short first_block_usage;
|
||||
} MEM_ROOT_SAVEPOINT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user