Cerebro (was Re: Almost 50% less free memory in joyride-2302 compared with Update.1 (708))

david at lang.hm david at lang.hm
Sun Aug 24 06:54:48 EDT 2008


On Sun, 24 Aug 2008, Polychronis Ypodimatopoulos wrote:

> I did the following as a basic test for memory usage of various python
> modules. I did the test on my computer, a 32-bit Centrino laptop running
> ubuntu.
>
> Let's start with the following code:
>
>    import gobject
>    mainloop = gobject.MainLoop()
>    mainloop.run()
>
> Cost: 1.2MB of memory (1.2MB total)
>
>
> Add a dummy class, like the following:
>
>    import dbus
>    import dbus.service
>    class Dummy(dbus.service.Object):
>       pass
>
> Additional cost: 0.9MB of memory (2.1MB total)
>
>
> Importing some more modules, like the following:
>
>    import time, sys, os, traceback
>    from select import select
>    from socket import *
>    from random import random
>    from struct import pack, unpack
>    from optparse import OptionParser
>    from os.path import basename
>
> Additional cost: 1.0MB of memory (3.1MB total)
>
>
> Running the same thing as above as root:
> Additional cost: 2.8MB of memory (5.9MB total)  (WHY?!?!?)

I wouldn't be surprised to leard that one of the modules included a bunch 
of extra functionality if you are root.

for example dbus may find a bunch more things that you can do if you are 
root.

it would probably be worthwhile narrowing down which module(s) increase 
their size if you are root.

David Lang

>
> Nothing specific to cerebro up to this point.
>
>
> Running Cerebro fully-blown as root:
> Additional cost: 1.3MB of memory (7.2MB total)
>
>
> It doesn't seem to me that there's much I can do, except for writing
> some parts of Cerebro in C.
>
> Pol
>
>



More information about the Devel mailing list