[Tutor] memory problem (II part)
Guillermo Fernandez Castellanos
guillermo.fernandez at epfl.ch
Tue Jan 13 12:18:48 EST 2004
Hi,
Thanks for the replies.
I tried the del statement, but does not seem to work for me. Maybe due
to the high number of functions and variables, I was not able to
identify rigth the variable to del. When one function is called and
returns, it's the memory used by it's variables make free?
I ahve been a little confusing in the extract of code I gived. I use
SQlite as database, and PySqlite for interfacing. I send a link to the
(actual) code. it may be a little bit confusing and big:
http://diwww.epfl.ch/~cfernand/begotutor.tar.gz
The code is supposed to go through logs of the wireless network of my
university, parse them and store the parsed results in a database. Then
this database will be queried interactivelly (with a command line
interface) to get different information and statistics.
A little explanation of the code:
bego.py : Command line interface. Simply interfaces the
functions of begohandler to the cmd module to create commands.
begohandler.py : interface to all functions bego is supposed to do
(simple ones as opening and closing DBs, or more complicated ones like
retrieving from the logs all the sessions of given macs)
files.py : interface for opening and closing files. I'll
delete it soon...
mac.py : identifies MAC addresses and vendors
statemachine.py : identifies sessions for MAC addresses or APs
syslogdb.py : interface to create, fill and retrieve information
from the database. I use fetchall() here.
syslogparse.py : the parse of the log files is done here
The problematic code is then probably shared among several files. When I
start my program and do a 'macsessions' command (that will identify all
sessions of a command) it will launch the do_macsessions function of
begohandler, that will launch the macsessions function of statemachine.
This function will call get_macsessions that will query the database
through the function machistory, both in statemachine, that will call
execute function in the syslogdb module to interface with the database.
Complicated way, but I wanted a lot of modularity. it's quite clear when
you catch the logic...
The main idea is that variables that take lot's of place exist all over
the code. I tried to delete some of them, when they are not returned,
but memory does not get lower.
Could this memory be occupied by the SQLite database itself?
Could the weakref be of any help here?
Comments about the code or logic are of course wellcome. I'm a begginer
in programming design.
Thanks again,
Guille
More information about the Tutor
mailing list