Better results from memory leak effect.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0b80b74be3
commit
1754f49b68
@ -6,22 +6,20 @@ namespace tests {
|
|||||||
LOGln("Tests * Running test for memory leaks...");
|
LOGln("Tests * Running test for memory leaks...");
|
||||||
test_effects_for_memory_leaks();
|
test_effects_for_memory_leaks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_effects_for_memory_leaks() {
|
void test_effects_for_memory_leaks() {
|
||||||
int i=0;
|
int i=0;
|
||||||
Effect* effect;
|
Effect* effect;
|
||||||
int32_t diffs[3] = {0, 0, 0};
|
int32_t diffs[3] = {0, 0, 0};
|
||||||
int32_t usage = 0;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
for (int j=0; j<3; j++) {
|
for (int j=0; j<3; j++) {
|
||||||
int free_at_start = ESP.getFreeHeap();
|
int free_at_start = ESP.getFreeHeap();
|
||||||
effect = select_effect(i);
|
effect = select_effect(i);
|
||||||
if (j==0) usage = free_at_start - ESP.getFreeHeap();
|
|
||||||
if (effect == NULL) return;
|
if (effect == NULL) return;
|
||||||
delete effect;
|
delete effect;
|
||||||
diffs[j] = free_at_start - ESP.getFreeHeap();
|
diffs[i] = ESP.getFreeHeap() - free_at_start;
|
||||||
}
|
}
|
||||||
LOGln("Tests * Memory usage of effect #%d: %d, leakage %d, %d, %d", i, usage, diffs[0], diffs[1], diffs[2]);
|
LOGln("Tests * Memory leakage of effect #%d: %d, %d, %d", i, diffs[0], diffs[1], diffs[2]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user