Are you sure the leak is due to persistCacheToFile()? It looks like your
FileManager::loadCacheFromFile() method is leaking the protocol buffer when
you are reading the cache back in.
If that's not the case, can you send a small reproduction of the problem?
On Tue, Nov 24, 2009 at 2:03 AM, Greg Burri <greg.bu...@gmail.com> wrote:
> I'm using Protocol Buffers in an open source project. 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 to do that.
> The persist routine 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());' 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);'.
> Nonetheless I always observe some memory leak.
> Does it due to memory fragmentation ? It's very strange because this
> method 'FileManager::persistCacheToFile()' should delete all its
> memory when it returns. Should I use a other memory allocater like
> tcmalloc ?
>  : http://dev.euphorik.ch/projects/show/pmp
>  :
>  : FileManager::persistCacheToFile() :
>  :
> 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
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