[set] Use exact-allocation in copying

Significantly reduces memory consumption.
This commit is contained in:
Behdad Esfahbod 2022-12-31 13:33:25 -07:00
parent 2c64048bc4
commit 54dd01b865
1 changed files with 2 additions and 0 deletions

View File

@ -88,6 +88,8 @@ struct hb_bit_set_t
bool resize (unsigned int count, bool clear = true)
{
if (unlikely (!successful)) return false;
pages.alloc (count, true); /* Exact allocation. */
page_map.alloc (count, true); /* Exact allocation. */
if (unlikely (!pages.resize (count, clear) || !page_map.resize (count, clear)))
{
pages.resize (page_map.length);