Memory leakage mavavi

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Memory leakage mavavi

Sergiy Cherepov
Hi all!

I'm trying to create a movie and I need to run mayavi over 13000 vtk file. It takes quite a long time to do, but it's OK with me. I wrote a python script and calling it from another bash script to convert my files. After running conversion script for 3 days I found out that my X server takes 2.9 GB of memory.

That should correspond to some memory leakage in X server and/or mayavi.

Anyone have seen such thing and it is a way to fix this leakage.

I have 12 G of memory, and can survive, but conversion getting slower and slower :(

Serg. Running opensuse 11.2.

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Memory leakage mavavi

Gael Varoquaux
On Wed, Apr 14, 2010 at 11:46:56AM +0200, Sergiy Cherepov wrote:
>    I'm trying to create a movie and I need to run mayavi over 13000 vtk file.
>    It takes quite a long time to do, but it's OK with me. I wrote a python
>    script and calling it from another bash script to convert my files. After
>    running conversion script for 3 days I found out that my X server takes
>    2.9 GB of memory.

>    That should correspond to some memory leakage in X server and/or mayavi.

>    Anyone have seen such thing and it is a way to fix this leakage.

OK, this could be a bug on our side. If you can tell us what you are
doing, and reproduce the problem on a small example, we might be able to
track it down.

Also, are you clearing the figure between each frame? I would do an
'mlab.clf()' between each frame, elsewhere you can easily have objects
accumulating.

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Memory leakage mavavi

Sergiy Cherepov
In reply to this post by Sergiy Cherepov
Hello Ga.

Thank you for the fast response.

here is my script:

#####################################################
from os.path import join, abspath, dirname


from enthought.mayavi.api import Engine
from numpy import array
import time
import sys
# Usual MayaVi imports
from enthought.mayavi.scripts.util import get_data_dir
from enthought.mayavi.sources.api import VTKFileReader
from enthought.mayavi.modules.api import Outline, ScalarCutPlane, Streamline
from enthought.mayavi.modules.vectors import Vectors
from enthought.mayavi import mlab

PNGfilename = str(sys.argv[1] + ".png")
VTKfilename = str(sys.argv[1] + ".vtk")
#mlab.options.offscreen = True

def main():
    e = Engine()
    # Starting the engine registers the engine with the registry and
    # notifies others that the engine is ready.
    e.start()
    src = VTKFileReader()
    src.initialize(VTKfilename)
    e.add_source(src)
    # Create a new scene.
    vtk_file_reader = e.scenes[0].children[0]
    vtk_file_reader.point_scalars_name = 'z-component'
    win = e.scenes[0]
    #win.scene.off_screen_rendering = True
   # win.scene.children.point_scalars_name = 'z-component'
    win.scene.anti_aliasing_frames = 0
    win.scene.background = (0.95294117647058818, 0.95294117647058818, 0.95294117647058818)
    win.scene.x_minus_view()
    vectors = Vectors()
    e.add_filter(vectors, vtk_file_reader)
    #e.add_filter(vectors, e.scenes[0].children[0])
    vectors.glyph.glyph.range = array([ 0.        ,  1.00000003])
    vectors.glyph.glyph.progress = 1.0
    vectors.glyph.glyph.color_mode = 'color_by_scalar'
    vectors.actor.mapper.progress = 1.0
    vectors.actor.mapper.scalar_range = array([ 0.,  1.])
    vectors.glyph.color_mode = 'color_by_scalar'
    vectors.glyph.glyph_source.glyph_source = vectors.glyph.glyph_source.glyph_dict['cone_source']
    vectors.glyph.glyph.range = array([ 0.        ,  1.00000003])
    module_manager = e.scenes[0].children[0].children[0]
    module_manager.scalar_lut_manager.lut_mode = 'BrBG'
    #win.scene.camera.position = [63.0, 70.0, 1.0]
    win.scene.camera.position = [70.0, 70.0, 1.0]
    win.scene.camera.focal_point = [83.5, 69.5, 1.0]
    win.scene.camera.view_angle = 30.0
    #win.scene.camera.view_up = [0.0, 0.0, 1.0]
    win.scene.camera.clipping_range = [0.18239432281876272, 182.39432281876273]
    win.scene.camera.compute_view_plane_normal()
    #win.scene.render()
    mlab.savefig(PNGfilename, size=(1280, 720))

if __name__ == '__main__':
    main()
###################################################

I was trying to use offscreen randering - but I was getting error like Segmentation fault... and I give up.
I'm using screen rendering with usual X server. nothing special.

I passing filename from my bash script - but tis can't cause en error.

and, as you see, I'm not using  'mlab.clf()'. Will try soon after my converting done.

by the way is it some way to convert data faster. I'm doing now 4 frames per minute - it's quite long. I suppose off screen rendering should improve that - but it doesn't work for me now :(

Serg.


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev