WispRenderer icon indicating copy to clipboard operation
WispRenderer copied to clipboard

Memory leaks

Open Nielsbishere opened this issue 5 years ago • 9 comments

Is your request related to a problem? Please describe. There's several memory leaks that result in problems when the maya plugin unloads wips. This thread will be used to note the findings of the inspection.

Describe the solution you'd like These instances should be fixed.

Describe alternatives you've considered N.A.

Additional context Create an exit callback (call onexit(myCallback)), place a breakpoint on start and in the callback and take 2 snapshots to diff.

Nielsbishere avatar Jun 18 '19 11:06 Nielsbishere

// Make sure we free the data objects we allocated.
for (auto& data : m_data)
{
	delete data;
}

In frame_graph.hpp Destroy function Auto doesn't provide clarity about the type; but the type is void*. This means that it doesn't call free or the destructor of the object.

Memory impact

Among the largest left over objects are because of this issue (est. 20%)

Nielsbishere avatar Jun 18 '19 11:06 Nielsbishere

PhysicsEngine::destroy is never being called, leaving behind bullet's resources.

Memory impact

The biggest impact as bullet allocates several memory pools (est. 60%)

Nielsbishere avatar Jun 18 '19 12:06 Nielsbishere

texture_pool ptr is potentially never reset; leaving behind some memory.

Memory impact

Not that much (est. 5%)

Nielsbishere avatar Jun 18 '19 12:06 Nielsbishere

  • [x] aiScene* isn't being cleaned up
  • [x] Viknell probably still has materials left over
  • [x] Sponza probably still has materials left over

Nielsbishere avatar Jun 21 '19 09:06 Nielsbishere

  • [x] Models don't clean up their allocated materials
  • [x] Physics component doesn't clean up the rigid bodies, shapes, etc.

Nielsbishere avatar Jun 21 '19 09:06 Nielsbishere

  • [ ] Thread pool enqueue leaks memory

Nielsbishere avatar Jun 21 '19 10:06 Nielsbishere

  • [x] Build acceleration structure task doesn't clean up the CB

Nielsbishere avatar Jun 21 '19 10:06 Nielsbishere

Possible issues to look into further: Left-over data includes; C++ initialization data which should be taken care of by the program finishing unloading. Other than that; file streams seem to have temporary memory that may or may not be deleted after program end.

Nielsbishere avatar Jun 21 '19 14:06 Nielsbishere

Even though CPU memory leaks are mostly cleaned up, there could potentially still be GPU memory leaks.

Nielsbishere avatar Jun 23 '19 13:06 Nielsbishere