awslabs/homomorphic-implementors-toolkit

How to free serialized objects?

Closed this issue · 1 comments

Serializing any HIT object allocates a lot of memory, but it's not clear how to free this memory.

Based on my reading of the protocol buffer documentation, our consistent use of the protobuf function set_allocated_foo(Foo*) results in the protobuf object obtaining ownership of the pointer argument. Although I couldn't find documentation saying this, I think that means that freeing the protobuf object will result in freeing that pointer as well. This means that the user only needs to free the serialized protobuf object, which will automatically free everything it points to.