Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 memory leaks in mesh loading #1063

Closed
2 tasks done
Aneoshun opened this issue May 1, 2018 · 2 comments
Closed
2 tasks done

3 memory leaks in mesh loading #1063

Aneoshun opened this issue May 1, 2018 · 2 comments

Comments

@Aneoshun
Copy link

Aneoshun commented May 1, 2018

Bug Report

Please answer the following questions for yourself before submitting an issue.

  • I checked the documentation and found no answer.
  • I checked to make sure that this issue has not already been filed.

Environment

  • DART version: master
  • OS name and version name(or number): Ubuntu 16.04
  • compiler name and version number: GCC 5.4

Hi all,

I have identified 3 leaks coming from the usage of Assimp's API.

  1. In the destructor of MeshShape, delete mMesh; should be replaced by aiReleaseImport(mMesh); . The reason is that the memory associated to this mesh is stored and managed by the Importer used to create this mesh, aiReleaseImport will clean all this for you. See here http://assimp.sourceforge.net/lib_html/usage.html

    delete mMesh;

  2. The propertyStore instanciated here

    aiPropertyStore* propertyStore = aiCreatePropertyStore();

    is never freed. I suggest to add aiReleasePropertyStore(propertyStore); at the end of the loadMesh function.

  3. The aiFile instanciated here

    aiFile* out = new aiFile;

    is not freed by the close protocol .
    I have added delete _file; after this line
    getIOSystem(_io)->Close(getIOStream(_file));

    and it solves my memory leaks issue.

After fixing these 3 leaks (plus one directly in Assimp assimp/assimp#1934 ) I have no more memory leak according to valgrind.
Let me know if you need more details.

I hope this will help you.

@jslee02
Copy link
Member

jslee02 commented May 3, 2018

Appreciated for the detailed report. #1066 is created to fix the memory leaks.

@Aneoshun
Copy link
Author

Aneoshun commented May 4, 2018

Thanks!

@Aneoshun Aneoshun closed this as completed May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants