Hi, 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 directories. 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] : http://git.euphorik.ch/index.cgi?p=aybabtu.git;a=blob;f=application/Protos/files_cache.proto;h=b6dca154ae46b57c29cf3a4b66c9bece52dd3953;hb=b60e04e926bff06ec1707cc13aa70b6a4b8aaa1c [3] : FileManager::persistCacheToFile() : http://git.euphorik.ch/index.cgi?p=aybabtu.git;a=blob;f=application/Core/FileManager/priv/FileManager.cpp;h=c33f94986bef3edcb6ca2ce539fdc11df0bb2b1e;hb=b60e04e926bff06ec1707cc13aa70b6a4b8aaa1c#l289 [4] : http://git.euphorik.ch/index.cgi?p=aybabtu.git;a=blob;f=application/Core/FileManager/priv/Cache/Directory.cpp;h=0818fefdf7ba2b63918c0157f295afc72c492f03;hb=b60e04e926bff06ec1707cc13aa70b6a4b8aaa1c#l76 Thanks in advance ! /Greg -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
