I'm using Protocol Buffers in an open source project[1]. I have a tree
structure in memory which represents some directories and files.
This structure must be persisted, so I've defined some protocol
messages[2] to do that.

The persist routine[3] will run through the tree structure to build a
'Protos.FileCache.Hashes' message and serialize it to the hard drive,
then this message will be deleted.

Each time I persist, the memory will increase by ~200ko (very
approximatively) for a tree which contains ~30'000 files and ~4'000
I Tried to remove all 'set' like 'dirToFill.set_name(this->getName
().toStdString());'[4] to avoid memory leak from my code and kept only
the Protocol Buffer methods. I also removed the serialize call
'Common::PersistantData::setValue(FILE_CACHE, hashes);'[3].
Nonetheless I always observe some memory leak.

Does it due to memory fragmentation ? It's very strange because this
method 'FileManager::persistCacheToFile()'[3] should delete all its
memory when it returns. Should I use a other memory allocater like
tcmalloc ?

[1] : http://dev.euphorik.ch/projects/show/pmp

[2] :

[3] :  FileManager::persistCacheToFile() :

[4] :

Thanks in advance !



You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to