[glass] Eliminate unnecessary memory allocations
commit0c2a53edfef81debfb88aa48afaad5f52eea820c
authorOlly Betts <olly@survex.com>
Mon, 21 Aug 2023 00:17:58 +0000 (21 12:17 +1200)
committerOlly Betts <olly@survex.com>
Mon, 21 Aug 2023 00:17:58 +0000 (21 12:17 +1200)
tree5ebb4bdc1ce638422d3d3037e4825e3535aa46ff
parenta6724a4f0d6dc42d3c529242242ab8bc35767a56
[glass] Eliminate unnecessary memory allocations

When committing changes, we were allocating blocks for all levels of the
built-in cursor in each writable table, even those that weren't in use.

The worst case is a really small database with all optional tables
existing which would have 54 unused allocations of blocksize + 8 bytes,
which with the default 8K block size is ~432KB per WritableDatabase;
if you explicitly ask for 64K block size it'll be ~3.4MB.

For a more typical WritableDatabase it's probably going to be more like
half these numbers.
xapian-core/backends/glass/glass_table.cc