Open solarjoe opened 7 years ago
@solarjoe, did you discover a workaround for this?
No, sorry. Do you see a similar behaviour?
@solarjoe Put the figure code outside the loop, and just clear the figure not close the window. Then you will find the magic happen. ` import numpy as np from mayavi import mlab
n = 10000 nt = 5000 fig = mlab.figure(bgcolor=(1.0, 1.0, 1.0), size=(1600, 900)) for k in range(10000):
x = np.random.rand(n)
y = np.random.rand(n)
z = np.random.rand(n)
triangles = np.random.randint(n, size=(nt, 3))
mlab.triangular_mesh(x, y, z, triangles, scalars=np.random.rand(n))
mlab.clf()
`
@eleboss, that seems to work, thanks! Any idea why the garbage collection does not work?
so far, nop. Best.
---Original--- From: "solarjoe"notifications@github.com Date: Thu, Jun 27, 2019 12:52 PM To: "enthought/mayavi"mayavi@noreply.github.com; Cc: "eleboss"jeremyele@Foxmail.com;"Mention"mention@noreply.github.com; Subject: Re: [enthought/mayavi] Memory leak while rendering many images (#517)
@eleboss, that seems to work, thanks! Any idea why the garbage collection does not work?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Mess up while using multi-processing, may because single figure is created but using clf by different thread. :-/ Put the figure code inside the loop and so far so good. :->
@solarjoe Put the figure code outside the loop, and just clear the figure not close the window. Then you will find the magic happen. ` import numpy as np from mayavi import mlab
mlab.options.offscreen=True
n = 10000 nt = 5000 fig = mlab.figure(bgcolor=(1.0, 1.0, 1.0), size=(1600, 900)) for k in range(10000):
x = np.random.rand(n) y = np.random.rand(n) z = np.random.rand(n) triangles = np.random.randint(n, size=(nt, 3)) mlab.triangular_mesh(x, y, z, triangles, scalars=np.random.rand(n)) mlab.clf()
`
Hello,
there might be a memory leak when rendering many images in a for loop.
WinPython-64bit-3.4.4.1 Mayavi 4.4.4 VTK 7.0.0
Running the code below I can see the "Commit" memory filling up. Once full it crashes the memory frees. The calculations started at the red marks, were stopped or crashed at the black marks. At the blue marks the "Physical memory" started to fill up.
I don't know exactly on how to interpret this.
Other things I noticed
mlab.options.offscreen=True
Here is a working example: