[osg-users] Memory leak when using a pixel buffer to generate thumbnails

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Tue Jun 23 10:10:21 PDT 2020


I can;t say what the leak will be from the code supply but I can say that 
creating a dedicated viewer, rendering a frame, then destroying really 
isn't an efficient way to go about generating a thumbnail image.  Rather 
than than debug a dubious approach I'd suggest you leave it and try another 
lighter weight approach.

The best approach is something I can't say at this point as I don't know 
enough about your application and your needs for generating a thumbnail.  
Is it a one off activity, something you do offline, something that is done 
occasionally?  How to go about things depends upon your usage case.

As a general comment, creating an destroying objects on OpenGL and 
consequently the OSG is expensive.  It's far better to create once and 
reuse, even if you don't reuse often.

Also creating separate graphics context is very expensive, if you already 
have a graphics context then the best thing to do for offscreen rendering 
is to your a frame buffer object and render to texture.  This way you can 
minimize the amount of new GL objects being created for the task,  W.r.t 
running in a background thread, OpenGL isn't a multi-threaded API, you can 
only multi-thread with multiple graphics context with t a thread per 
context.  It's only really suitable for mulitple GPU tasks.  It's typically 
far better to just add the work to the standard frame and run it as part of 
your normal viewer.

With the OSG you can toggle on/off render to texture by setting the 
NodeMask of an osg::Camera.


-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/a8394d4f-92a9-4736-b51f-34b5cf5bee9fn%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200623/af8ebaff/attachment.html>


More information about the osg-users mailing list