In my particular scene I have a Scene class, which operates as kind of a context for my operations and holds all the meshes in the scene. I send my scene down to the python side so import methods will import into the containers in the scene object. For example, addMeshFromFile(scene, fileName) which puts the data from the file into the scene object. However, if the scene object isn't be returned, it seems I'm just copying the scene object (which might be memory expensive), adding the data to the copy, and throwing the copy away as I don't return it and it doesn't affect my original scene object in C++ that I passed in. I assume this is a fairly common problem and I need to rework my API somehow like providing a more robust copy constructor that does a shallow copy of my data containers. Still, I might have to reorganize it so I'm not passing my scene to python. If an object is copied every time, I think that might be memory prohibitive. I'm including my current source from github.
// header file handling my scene and it's data https://github.com/strattonbrazil/Sunshine/blob/master/src/scene.h // functions for creating the bindings to python https://github.com/strattonbrazil/Sunshine/blob/master/src/python_bindings.cpp // python file which reads a file and adds it to the scene https://github.com/strattonbrazil/Sunshine/blob/master/src/objImporter.py Do I need to change need to change my copy constructor to do a more shallow copy? Maybe change my internal scene objects to pointers? Would this alleviate the memory issue? _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig