My CVI application uses list related functions from NI's Programmer's Toolbox library.
It is all OK when it runs in Release mode. But after switching to Debug mode it gradually slowes down. This behavior is also visible in the example code attached below.
Do you know why it happens and how to fix it?
Michal Krol
-----------------------------
#include
#include "toolbox.h"
#include
int main (int argc, char *argv[])
{
int i, j, N, Mem;
void *p;
double T;
ListType List;
N = 2000;
List = ListCreate(128);
for (i = 0; i < 5; i++) {
T = Timer();
for (j = 1; j <= N; j++) {
p = malloc(128);
ListInsertItem (List, &p, E
ND_OF_LIST);
}
for (j = 1; j <= N; j++) {
p = *(void**)ListGetPtrToItem(List, j);
free(p);
}
ListClear(List);
printf("%i. %.3lf\n", i+1, Timer() - T);
}
ListDispose(List);
CVIDynamicMemoryInfo ("", NULL, &Mem, 0);
printf("\nAlloc mem: %i bytes\nPress ENTER\n", Mem);
scanf("*s");
return 0;
}
----------------------------