Announcement

Collapse
No announcement yet.

How to free up geometry memory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to free up geometry memory

    Hi,
    I am using the geomMeshLoader to send geometry to VRay. However I don't know how to free up this memory. If I use delete on the parameters, the Maya render is crashing at 96%. I tried with setCount(0), but this does not seem to free up memory (1.5GB -> 13 GB after 900 frames).
    I have tried to add all reservations in the factory, but then the render is crashing at factory.clear().
    How to properly free up geometry after each frame ?

    Global variables:
    Code:
    DefVectorListParam *my_param_vertices;
    DefIntListParam *my_param_faces;
    DefVectorListParam *my_param_normals;
    DefIntListParam *my_param_normalFaces;
    DefIntListParam *my_param_shaders;
    DefMapChannelsParam *my_param_uvs;
    In the code:
    Code:
    void GeomMeshLoader::preRenderBegin(VR::VRayRenderer *vray)
    {
            baseGeomPlugin=newPlugin("GeomStaticMesh");
            <...>
    }
    
    void GeomMeshLoader::frameBegin(VR::VRayRenderer *vray)
    {
            my_param_vertices=new DefVectorListParam("vertices",1);
            my_param_faces=new DefIntListParam("faces",1);
            my_param_normals=new DefVectorListParam("normals",1);
            my_param_normalFaces=new DefIntListParam("faceNormals",1);
            my_param_shaders=new DefIntListParam("face_mtlIDs",1);
            my_param_uvs=new DefMapChannelsParam("map_channels",1);
    
            baseGeomPlugin->setParameter(my_param_shaders);
            baseGeomPlugin->setParameter(my_param_vertices);
            baseGeomPlugin->setParameter(my_param_faces);
            baseGeomPlugin->setParameter(my_param_normals);
            baseGeomPlugin->setParameter(my_param_normalFaces);
     <...>
    }
    
    void GeomMeshLoader::postRenderEnd(VR::VRayRenderer *vray)
    {
         delete my_param_vertices; ----> Putting simply this delete will crash the render and maya
         delete my_param_faces;
         delete my_param_normals;
         delete my_param_normalFaces;
         delete my_param_shaders;
         delete my_param_uvs;
    }
    Thanks !
    Last edited by lcrivell; 27-01-2016, 02:49 PM.

  • #2
    OK, found it. Basically deleting directly the parameters is not enough.
    factory.clear() is really the way to go, but I was storing static parameters in it that made the function fail. Removing theses static parameters made it work.

    Comment

    Working...
    X