[Tutor] Memory Problem

DORSEY_EDMUND_K@LILLY.COM DORSEY_EDMUND_K@LILLY.COM
Thu Jul 3 16:39:04 2003


This is a multipart message in MIME format.
--=_alternative 0071495E05256D58_=
Content-Type: text/plain; charset="us-ascii"

My python crashes on large datasets and works fine with small ones. When 
it crashes it just tells me it's a memory error.

What's odd is that I have 2 GB of memory and the dataset I am loading is 
only 35 MB.  The process I am running on the data creates a file 8 times 
larger.  So that would be 280 MB which still seems to leave plenty of 
memory.

It says the problem is with this line of code

return x + (y*self._newXsize) + z * (self._newXY)

Here the value returned ranges from 0 to about 100 million

I have a  function which runs a loop do I need to delete anything to free 
up space?  For example, if you have a function foo

def foo(self):
    x = 1
    y = 2
    z = 3
    return x*y*z

and call it a million times from another function ie.

def callFoo(self):
    for i in range(0, 1000000000):
        self.foo()

Do the x,y,z variables in foo get deleted or does it need to be done 
manually? 

Thank you. ~Ed


--=_alternative 0071495E05256D58_=
Content-Type: text/html; charset="us-ascii"


<br><font size=2 face="sans-serif">My python crashes on large datasets and works fine with small ones. When it crashes it just tells me it's a memory error.</font>
<br>
<br><font size=2 face="sans-serif">What's odd is that I have 2 GB of memory and the dataset I am loading is only 35 MB. &nbsp;The process I am running on the data creates a file 8 times larger. &nbsp;So that would be 280 MB which still seems to leave plenty of memory.</font>
<br>
<br><font size=2 face="sans-serif">It says the problem is with this line of code</font>
<br>
<br><font size=2 face="sans-serif">return x + (y*self._newXsize) + z * (self._newXY)</font>
<br>
<br><font size=2 face="sans-serif">Here the value returned ranges from 0 to about 100 million</font>
<br>
<br><font size=2 face="sans-serif">I have a &nbsp;function which runs a loop do I need to delete anything to free up space? &nbsp;For example, if you have a function foo</font>
<br>
<br><font size=2 face="sans-serif">def foo(self):</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; x = 1</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; y = 2</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; z = 3</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; return x*y*z</font>
<br>
<br><font size=2 face="sans-serif">and call it a million times from another function ie.</font>
<br>
<br><font size=2 face="sans-serif">def callFoo(self):</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; for i in range(0, 1000000000):</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; self.foo()</font>
<br>
<br><font size=2 face="sans-serif">Do the x,y,z variables in foo get deleted or does it need to be done manually? &nbsp;</font>
<br>
<br><font size=2 face="sans-serif">Thank you. ~Ed</font>
<br>
<br>
--=_alternative 0071495E05256D58_=--