|
From: Jason M. <jas...@vp...> - 2010-10-29 21:22:24
|
Hi Bruce,
I think the difference here is that I am changing the pos (in fact only the
y part of pos)
each cycle. You are deleting the curve and creating a new one.
This is an important clue as it means it is the part of code that alters the
curve that has a problem, not the act of
creating, drawing and distruction.
Try the same loop, but don't re-create c each pass. Create it outside the
loop and update it's y by some factor.
Try this and take a look at task manager:
from visual import *
import random
c=curve(pos=[[0,0,0],[1,1,1]])
while True:
c.pos=[[random.random() for x in ones(3)],[random.random() for x in
ones(3)]]
For me this loop causes pythonw.exe to consume about 8Mbyte a second.
I also note that when only the original static line is showing pythonw still
consumes about 10k a second - which is odd.
j.
-----Original Message-----
From: Bruce Sherwood [mailto:bas...@nc...]
Sent: 29 October 2010 18:33
To: vpusers
Subject: Re: [Visualpython-users] Possible memory leak
Following your suggestion, I tried the following in VPython 5.4 on
Python 2.7 in Windows 7
from visual import *
N = 1000000
pts = ones(N*3).reshape(N,3)
while True:
c = curve(pos=pts)
c.visible = False
del c
Is this something like what you did? I watch the Windows Task Manager
and cannot see any change in the memory usage.
Bruce Sherwood
On Fri, Oct 29, 2010 at 8:38 AM, Beracah Yankama <be...@mi...> wrote:
> hah! now i'm not the only one who noticed this! i was graphing a lot
> of data too with lots of curves (a graph cluster growing to thousands of
> nodes and edges, which are dynamically positioned), but after like 200
> edges and being repositioned, an out of memory error gets thrown. I had
> tracked it down to vpython.
>
> I had written (in case it is helpful to you):
> """
> I made a test script, that only
> creates objects in the window, then deletes them over and over, and I
> found the long-term memory use/growth to be related linearly to the .pos
> attribute. For instance, a curve with 20 points leads to unreleased
> memory that grows 10x as fast as curves with only 2 points. Similarly,
> if I assign the .pos attribute as a numpy ndarray directly, the leak
> grows twice as fast as if assign the individual xyz values.
> """
>
> B
>
----------------------------------------------------------------------------
--
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Visualpython-users mailing list
Vis...@li...
https://lists.sourceforge.net/lists/listinfo/visualpython-users
|