Hello.
Our team encountered possible memory leak inside natnet library with ue4 plugin. Our memory starts to consume something around 3-4 MB per one rigidbody in several seconds and literally eats 100-200 MB per several seconds when we streaming more data. Even with one tracking body it can consume several GB of memory in ten minutes.
We used ue4 memory profiles and didnot found any memory leaks in ue4 objects. Can we have get sort of information how memory management of frame data is handled inside natnet?
UE4 plugin - possible memory leak
Re: UE4 plugin - possible memory leak
Hi again.
We traced down problem to function in NatNetClient.h:
We made a simple standalone project in ue4 only with starter content and optitrack plugin.
Steps to reproduce:
1) Add client origin to map (loopback from motive from saved .tak file, unicast)
2) Add cube with rigidbody.
3) Run and check to see that cube is moving around and we have no leaks in memory.
3) Inside OptitrackClientOrigin.cpp in method add code
inside first
4) Build, run and see how it will start to eat your memory.
Can we get some feedback on this? Looks like Client->GetDataDescriptionList(&pDataDefs) causing memory leak.
I can send our test project to someone at optitrack.
We traced down problem to function in NatNetClient.h:
Code: Select all
ErrorCode GetDataDescriptionList( sDataDescriptions** ppDataDescriptions );
Steps to reproduce:
1) Add client origin to map (loopback from motive from saved .tak file, unicast)
2) Add cube with rigidbody.
3) Run and check to see that cube is moving around and we have no leaks in memory.
3) Inside OptitrackClientOrigin.cpp in method
Code: Select all
bool AOptitrackClientOrigin::GetLatestRigidBodyState( int32 RbId, FOptitrackRigidBodyState& OutRbState )
Code: Select all
sDataDescriptions* pDataDefs = nullptr;
//int nBodies = Client->GetDataDescriptions(&pDataDefs);
ErrorCode result = Client->GetDataDescriptionList(&pDataDefs);
inside first
Code: Select all
If
Can we get some feedback on this? Looks like Client->GetDataDescriptionList(&pDataDefs) causing memory leak.
I can send our test project to someone at optitrack.
-
- Posts: 19
- Joined: Mon Mar 21, 2016 2:02 pm
Re: UE4 plugin - possible memory leak
Hi,
Apologies for the delayed response. A lot of the team, myself include, just got back from GDC. This information is very helpful. We are looking into a fix now. Thankyou.
Apologies for the delayed response. A lot of the team, myself include, just got back from GDC. This information is very helpful. We are looking into a fix now. Thankyou.
-------
James Shagan Overman
Customer Experience Manager
shagan.overman@optitrack.com
James Shagan Overman
Customer Experience Manager
shagan.overman@optitrack.com
-
- Posts: 8
- Joined: Wed Oct 21, 2015 9:25 am
- Location: Corvallis, OR
Re: UE4 plugin - possible memory leak
Thanks for the report.
I noticed that your steps to reproduce include modifying the code of the plugin, and it's not immediately obvious why. Can you help me understand whether any such problem occurs in an unmodified copy of the plugin, and what the intent of the code change is?
Best,
I noticed that your steps to reproduce include modifying the code of the plugin, and it's not immediately obvious why. Can you help me understand whether any such problem occurs in an unmodified copy of the plugin, and what the intent of the code change is?
Best,
Zach Brockway
Senior Software Engineer | NaturalPoint
Senior Software Engineer | NaturalPoint
Re: UE4 plugin - possible memory leak
Changes in plugin code were caused by our code architecture.
There is no memory leak in unmodified version of plugin, because function that causing it not used.
It starts to leak only after multiply calls to Client->GetDataDescriptionList().
There is no memory leak in unmodified version of plugin, because function that causing it not used.
It starts to leak only after multiply calls to Client->GetDataDescriptionList().
-
- NaturalPoint Employee
- Posts: 719
- Joined: Mon Jan 19, 2015 11:52 am
Re: UE4 plugin - possible memory leak
Hi Mernion,
Client->GetDataDescriptionList() is not intended to be called very often. Usually it is only called a single time when the connection to Motive is first established. While it sounds like there is a memory leak there, you should be able to use NatNet reliably even without a fix. The SampleClient.cpp provides an example for how to use the Client->GetDataDescription function.
Our developers have been notified of the memory leak and will address it when they are able.
If you have some sort of special application that requires updating assets frequently, let us know and we will see what we can do.
Best,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
Client->GetDataDescriptionList() is not intended to be called very often. Usually it is only called a single time when the connection to Motive is first established. While it sounds like there is a memory leak there, you should be able to use NatNet reliably even without a fix. The SampleClient.cpp provides an example for how to use the Client->GetDataDescription function.
Our developers have been notified of the memory leak and will address it when they are able.
If you have some sort of special application that requires updating assets frequently, let us know and we will see what we can do.
Best,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer