[subset-serialize] release discarded objects

pull/4933/head
Qunxin Liu 3 months ago committed by Behdad Esfahbod
parent 622e9c33c3
commit b5ed7846d6
  1. 9
      src/hb-serialize.hh

@ -400,6 +400,7 @@ struct hb_serialize_context_t
{ {
merge_virtual_links (obj, objidx); merge_virtual_links (obj, objidx);
obj->fini (); obj->fini ();
object_pool.release (obj);
return objidx; return objidx;
} }
} }
@ -463,9 +464,11 @@ struct hb_serialize_context_t
while (packed.length > 1 && while (packed.length > 1 &&
packed.tail ()->head < tail) packed.tail ()->head < tail)
{ {
packed_map.del (packed.tail ()); object_t *obj = packed.tail ();
assert (!packed.tail ()->next); packed_map.del (obj);
packed.tail ()->fini (); assert (!obj->next);
obj->fini ();
object_pool.release (obj);
packed.pop (); packed.pop ();
} }
if (packed.length > 1) if (packed.length > 1)

Loading…
Cancel
Save