[unpacker] improve memory usage