From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

List operations are slowing down in debug mode

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;
}
----------------------------
0 Kudos
Message 1 of 2
(2,575 Views)
I am not sure if this will help, but if you have anything in your WATCH window, then debug mode can get bogged down.
0 Kudos
Message 2 of 2
(2,575 Views)