What is a good tool for analyzing the size of each object in the ZODB, pickled and unpacked in memory? I'm using Zope 2.6.2. With 62,214 objects in memory, the server uses 491MB of RAM. That gives roughly 8kb per object, assuming other things aren't don't contribute to memory usage as well. Is there any way to predict how much memory is going to be used? Bye, -- Bjorn
Bjorn Stabell wrote at 2003-10-22 15:53 +0800:
What is a good tool for analyzing the size of each object in the ZODB, pickled and unpacked in memory? I'm using Zope 2.6.2.
I do not think there is such a tool. I enhanced the output of "fsdump" to include the pickle size of object records in a transaction. The main purpose has been to analyse the reasons for unexpected transaction sizes (turned out to be ZCatalog Metadata). Dieter
Le mer 22/10/2003 à 09:53, Bjorn Stabell a écrit :
What is a good tool for analyzing the size of each object in the ZODB, pickled and unpacked in memory? I'm using Zope 2.6.2.
With 62,214 objects in memory, the server uses 491MB of RAM. That gives roughly 8kb per object, assuming other things aren't don't contribute to memory usage as well. Is there any way to predict how much memory is going to be used?
Bye,
Counting elements of an object is a good start. Go and write some depth-first object traversal code. This should be simple (in fact I've already done it), if you do it recursively. Then, add some bits about the size of the objects you traverse (or you count). Basically, - you count 4 octets (32 bits ptr) for each object reference encountered. - for leaf objects, you can make good guesses about their sizes, e.g some int may be 4 octets, some string may be 2 octets (unicode ?) * len (the string), etc... you get the idea - for collection, repeat like above, recursively. The overhead for lists/dictionaries must be so light that you just sum up the size of the element's list, for dictionary you add the key size, ... etc.. Should be straightforward. Ah, don't follow weak pointers, if there are any... Regards, Aurélien. Q: What's the difference between a dead dog in the road and a dead lawyer in the road? A: There are skid marks in front of the dog.
participants (3)
-
Aurélien Campéas -
Bjorn Stabell -
Dieter Maurer