<div dir="ltr">Hi Chris,<div><br></div><div>I'll have a look at the leads you've detailed on my return next week, </div><div><br></div><div>Cheers,</div><div>Robert.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 4 Jul 2019 at 10:42, Chris Djali <<a href="mailto:krizdjali@gmail.com">krizdjali@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Turns out that it's not a font in the object cache that's causing me grief after all, but instead the static default font here: <a href="https://github.com/openscenegraph/OpenSceneGraph/blob/OpenSceneGraph-3.6/src/osgText/Font.cpp#L40" rel="noreferrer" target="_blank">https://github.com/openscenegraph/OpenSceneGraph/blob/OpenSceneGraph-3.6/src/osgText/Font.cpp#L40</a>. This is initialised from a GLubyte array instead of a file, so never ends up in the object cache.<br>
<br>
I can manually call releaseGLObjects on it when a graphics context is destroyed, which solves the problem for my application, but I can provide an example of an OSG application that CodeXL says leaks stuff to prove that there's still a footgun.<br>
<br>
<br>
Code:<br>
int main()<br>
{<br>
osgViewer::Viewer viewer;<br>
<br>
// Use an auto transform so the text actually faces the screen<br>
osg::ref_ptr<osg::AutoTransform> scene = new osg::AutoTransform();<br>
scene->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);<br>
viewer.setSceneData(scene);<br>
<br>
osg::ref_ptr<osgText::Text> text1 = new osgText::Text();<br>
text1->setText("text1");<br>
scene->addChild(text1);<br>
<br>
// Display one or more frames<br>
viewer.setCameraManipulator(new osgGA::TrackballManipulator());<br>
for (int i = 0; i < 100; ++i)<br>
viewer.frame();<br>
<br>
// Remove a text node<br>
scene->removeChild(text1);<br>
<br>
// Pick which path depending on whether or not we trust all references to things to go away<br>
if (false)<br>
{<br>
text1->releaseGLObjects();<br>
}<br>
else<br>
{<br>
<br>
}<br>
<br>
text1 = nullptr;<br>
<br>
// osgText::Font::getDefaultFont::s_defaultFont still exists, so the default font isn't released<br>
<br>
return viewer.run();<br>
}<br>
<br>
<br>
<br>
As before, CodeXL is still reporting the following error:<br>
<br>
[Image: <a href="https://cdn.discordapp.com/attachments/502999428798480387/596112745104146487/unknown.png" rel="noreferrer" target="_blank">https://cdn.discordapp.com/attachments/502999428798480387/596112745104146487/unknown.png</a> ]<br>
<br>
Maybe it would be a good idea for static OSG objects to all be held together in a global vector somewhere so that their GL objects can be released whenever a context is destroyed. Maybe something like that exists already and the default font just got forgotten.<br>
<br>
Cheers,<br>
Chris<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=76365#76365" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=76365#76365</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>