Jump to content

[SOLVED] Memory leak in Materials::setParameterExpression()


photo

Recommended Posts

Posted

Dear Unigine team,

we discovered a memory leak in the Unigine Script Materials::setParameterExpression() method by invoking it per frame.
The memory leak is easy to reproduce with only a view modifications to the materials/2d_01.cpp sdk example (see attachments).

In our project we need to set the reflection plane in a mesh_reflection_2d material per frame. So we are in desperate need of a workaround for this issue!

It appears on my machine with the both the 06.04.2014 and 07.07.2014 windows game binary sdk.

Thank you!

Cheers, Helmut

post-990-0-36950300-1410527414_thumb.png

post-990-0-29849900-1410527451_thumb.png

2d_01.cpp

Posted

Hi Helmut,

 

Thank you for the test scene. I've added this issue to our internal bug tracker. However, not sure about workaround at this moment. I will ask devs and report back ASAP.

 

Sorry for the inconvenience caused.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Hi Helmut,

 

Just got responce from developers - this is actually not a bug.

 

You compile expression every update, so memory usage will grow constantly. To avoid such behavior you should modify material and add separate constant parameter that will be changed from outside without expression recompile. So, you need to call setParameterExpression() only once.

 

In attachment you can find modified version of 2d_01 sample with modified materials_mesh_reflection_2d_specular material.

 

Thanks!

 

materials_2d_01.zip

How to submit a good bug report
---
FTP server for test scenes and user uploads:

×
×
  • Create New...