Conversation
|
|
||
| QColor color = Qt::gray; | ||
| new rviz_rendering::Grid( | ||
| std::shared_ptr<rviz_rendering::Grid>(new rviz_rendering::Grid( |
There was a problem hiding this comment.
This is a temporary, so it will be deleted immediately which is definitely not what you want here.
Perhaps this has overlap with #165? @Martin-Idel-SI can you comment on this? It does look like a memory leak, but I don't have enough context atm to know where it should be owned and cleaned up.
There was a problem hiding this comment.
No overlap. The "real" grid is held (and properly deleted) in grid_display, which is loaded via pluginlib.
This grid belongs to the example scene (including the sphere) that was displayed with the rendering_example target. I think the whole scene gets loaded and discarded immediately in rviz, so I'm unsure whether we still need it.
| } else { | ||
| Ogre::RenderSystem * renderSys = ogre_root_->getRenderSystem(); | ||
| renderSys->createRenderSystemCapabilities(); | ||
| std::shared_ptr<Ogre::RenderSystemCapabilities>(renderSys->createRenderSystemCapabilities()); |
There was a problem hiding this comment.
I believe this does not need to be stored. I believe this is a singleton that was returned.
There was a problem hiding this comment.
I try to fix the issue, but not sure the fixing is correct or not.
Code scan found leaked storage: renderSys->createRenderSystemCapabilities()
build/rviz_ogre_vendor/ogre-master-ca665a6-prefix/src/ogre-master-ca665a6/OgreMain/include/OgreRenderSystemCapabilities.h
229 RenderSystemCapabilities* GLRenderSystem::createRenderSystemCapabilities() const
230 {
231 RenderSystemCapabilities* rsc = new RenderSystemCapabilities();
444 rsc->addShaderProfile("arbfp1");
// Resource rsc is not freed or pointed-to in function addShaderProfile
Ogre::RenderSystemCapabilities::addShaderProfile(Ogre::String const &) does not free or save its parameter this.
599 void addShaderProfile(const String& profile)
600 {
601 mSupportedShaderProfiles.insert(profile);
602
603 }
//addShaderProfile() does not free or save its parameter.
|
So, because you used the |
Use shared_ptr to avoid memory leak