Giter Site home page Giter Site logo

memory leak about gvdb-voxels HOT 4 CLOSED

nvidia avatar nvidia commented on July 26, 2024
memory leak

from gvdb-voxels.

Comments (4)

ramakarl avatar ramakarl commented on July 26, 2024

This should work.
Would be interesting to determine the root cause.

from gvdb-voxels.

oursnoir avatar oursnoir commented on July 26, 2024

Hmm, is there any destructor in the VolumeGVDB class that deallocate the following members (allocated in VolumeGVDB::Initialize)?

  • mCudpp (CPU and GPU leak ?)
  • mPlan_max (CPU and GPU leak ?)
  • mPlan_min (CPU and GPU leak ?)
  • mScene (CPU leak ?)
  • mPool (CPU and GPU leak ?)
  • cuVDBInfo (GPU leak only)
  • mTransferPtr (GPU leak only)

These are the ones for which I can't find any deallocation code and that I can (without a 100% certainty) relate to the trace given by a cuda-memcheck --leak-check full invocation.

Additionnaly there is no member method of VolumeGVDB that release the memory allocated by mPool.

I have to do something like (not sure what is absolutely necessary or not though):

gvdb->DestroyChannels();
gvdb->CleanAux();
gvdb->mPool->PoolReleaseAll();
gvdb->Clear();

But it doesn't solve the leak from the above-mentioned members.

from gvdb-voxels.

NBickford-NV avatar NBickford-NV commented on July 26, 2024

Hi all,

I finally implemented destructors for most of the main GVDB classes in cpmmits dc4d3a0 and f0d05bb.

This makes it so that
while (1) { nvdb::VolumeGVDB gvdb; gvdb.SetCudaDevice(GVDB_DEV_CURRENT); gvdb.Initialize(); }
should run without leaking memory (testing in gRenderKernel, the amount of memory used appears to be constant). Note that it's important to use GVDB_DEV_CURRENT when creating and destroying GVDB objects in a loop like this - otherwise, each GVDB instance will create a new CUDA context just for that instance, and since GVDB allows user code to pick up on the generated CUDA context, will keep the context around (and consequently accumulate CUDA contexts if run in a loop)!
while (1) { nvdb::VolumeGVDB gvdb; gvdb.SetCudaDevice(GVDB_DEV_FIRST); gvdb.Initialize(); }

In addition, cuda-memcheck --leak-check full should now run cleanly (with the exception of a CUDA/OpenGL interop error) on the three non-interactive samples.

Please let me know if this significantly breaks things, since it also slightly changes the semantics of setting the scene's camera and light objects (these functions now own the pointers that you pass to them), and could cause problems with applications that shared pointers to the same object across multiple volumes.

Hope this helps!

from gvdb-voxels.

NBickford-NV avatar NBickford-NV commented on July 26, 2024

Closing, since this seems to have been fixed by the commit described in the last post.

from gvdb-voxels.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.