Comment #10 on issue 402 by hlhhuang...@gmail.com: question for clear and parse
http://code.google.com/p/protobuf/issues/detail?id=402

Thank you for your detailed explanation.

But there is still memory increasing:

RecordSet* pRS = new RecordSet;
int count = 0;
while(1)
{
        pRS->Clear();
        
        //get a string (pStr)
        ...
        parse(*pRS,pStr);
        ...
        count++;
        if(1000 == count)
        {
                count = 0;
                delete pRS;
                pRS = new RecordSet;
        }
}

now, I only have a way that to solve memory increasing (but it is time-consuming):

while(1)
{
        RecordSet* pRS = new RecordSet;
        //get a string (pStr)
        ...
        parse(*pRS,pStr);
        ...
        delete pRS;
        }
}

you said "The allocated bar message will be deleted when the parent foo message is destroyed", for complex data Repeatedly clear() and parsefrom(), this relationship can be still maintained?

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to