Memory problem with savefig

Hello, I have been using Matplotlib lately for some
academic research. It seem to work just fine. The only
serious problem is a problem with memory. When I run
the following code, I get the memory increasing
linearly with the time. Soon (after around 20
generations, and 100 times is this part of the program
called) I get beyond the limits of my laptop, and the
simulation ends. Considering that I need to do at
least 200 generations, you can see that it is a
serious problem.

If I comment the savefig line the memory does not
I tried to add a garbage collection but I got no

Data is a list of list of data: i.e.
symbol2color a dictionary that for each list gives a
different color.

def fillstrip(lower,upper,color):
    x1 = range(0, len(lower), 1)
    x2 = x1[:]
    fill(x, y, color)

def area(data,color):
    "like the area matlab function"
    for (upper,c) in zip(data,color):
        upper=map((lambda x,y:x+y),lower,upper)

def PlotAreaOrganization(data,filename):
    for key in keys: colors.append(symbol2color[key])

Any suggestion? Is there any other way to save a
picture that might work better?



Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around