Hi,
I’m testing large object creation and removing with the following test code. This is needed for my usage purpose. I have found memory grow rapidly after some times.
Here is the test code. I added inside the HandleUpdate of the example 4.
int counter = 0;
Node* mushroomNodeTest [1000];
double obj = 0;
void StaticScene::HandleUpdate(StringHash eventType, VariantMap& eventData)
{
counter++;
if (counter == 1)
{
obj+=1000;
//instructionText->SetText(String(obj));
for (int i = 0; i < 1000; ++i)
{
mushroomNodeTest[i] = scene_->CreateChild("Mushroom");
mushroomNodeTest[i]->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
mushroomNodeTest[i]->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
mushroomNodeTest[i]->SetScale(0.5f + Random(2.0f));
StaticModel* mushroomObject = mushroomNodeTest[i]->CreateComponent<StaticModel>();
}
}
if (counter == 2)
{
if (mushroomNodeTest)
{
for (int i = 0; i < 1000; ++i)
{
mushroomNodeTest[i]->Remove();
}
}
counter = 0;
}
using namespace Update;
// Take the frame time step, which is stored as a float
float timeStep = eventData[P_TIMESTEP].GetFloat();
// Move the camera, scale movement with time step
MoveCamera(timeStep);
}