430 {
431 const int allocAmount = 9;
432 const int releaseAmount = 6;
433 int remainingAmount = allocAmount - releaseAmount;
434
435
436 bool wasEnabled = EnProfiler.RequestImmediateData();
437
438
439 int previousAlloc = EnProfiler.GetAllocationsOfClass(StaticGetType(EPTHelperClass), true);
440 int previousInstances = EnProfiler.GetInstancesOfClass(StaticGetType(EPTHelperClass), true);
441
442 array<ref EPTHelperClass> instanceArr = {};
443 for (int i = 0; i < allocAmount; ++i)
444 {
445 instanceArr.Insert(new EPTHelperClass());
446 }
447
448 for (int j = 0; j < releaseAmount; ++j)
449 {
450 delete instanceArr[j];
451 }
452
453 int postAlloc = EnProfiler.GetAllocationsOfClass(StaticGetType(EPTHelperClass), true);
454 int postInstances = EnProfiler.GetInstancesOfClass(StaticGetType(EPTHelperClass), true);
455
456 int alloced = postAlloc - previousAlloc;
457 int instances = postInstances - previousInstances;
458
459 Debug.TFLog(
string.Format(
"Profiling result: alloc: %1 | instances: %2", alloced, instances),
this,
"TestClassCountData");
460
461
462 if (!wasEnabled)
463 EnProfiler.Enable(false, true);
464
465
466 if (!
Assert(alloced == allocAmount))
467 {
469 }
470
471 if (!
Assert(instances == remainingAmount))
472 {
474 }
475
477 }
TFResult NTFR(TFR result)
bool Assert(bool condition)