Wednesday, April 18, 2012

Properly freeing Protocol Buffer memory

I am using Google Protocol Buffers in the following way:



void myfunc() {
Buffers::MyBuffer buf;
buf.ParseFromArray(data, datalen);
...
return;
}


The documentation for Protocol Buffers says that to free memory for a buffer that the object should be deleted. I'm no C++ genius, but I thought delete should only be called for objects allocated with new. Is memory cleaned up on return here?





No comments:

Post a Comment