Program eating memory, but only on one machine? (Solved, sort of)

Per B.Sederberg persed at princeton.edu
Mon Jan 22 20:44:01 CET 2007


Per B.Sederberg <persed <at> princeton.edu> writes:

> I'll see if I can make a really small example program that eats up memory on
> our cluster.  That way we'll have something easy to work with.

Now this is weird.  I figured out the bug and it turned out that every time you
call numpy.setmember1d in the latest stable release of numpy it was using up a
ton of memory and never releasing it.

I replaced every instance of setmember1d with my own method below and I have
zero increase in memory.  It's not the most efficient of code, but it gets the
job done...


def ismember(a,b):
    ainb = zeros(len(a),dtype=bool)
    for item in b:
        ainb = ainb | (a==item)
    return ainb

I'll now go post this problem on the numpy forums.

Best,
Per







More information about the Python-list mailing list