LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

heap overflow 6602

Hello all,
 
after several measurements, my program shuts down because of heap overflow.
I searched the forum and found out that on Win NT a maximum buffer of 64MB for buffered counter measurements exists.
I nearly reach these 64MB when measuring.
 
My question is:
 
How can I clear the buffer? I only allocate memory for 15 PWM-measurements and after calculation this memory is freed.
But it seems that the 6602 uses always new memory...
 
My system: PXI 233Mhz (!), PXI 6602
NI-Daq 6.9.1f28
measured signal 2x PWM, 5V
CVI 6.0
 
Measurement is done in a do while loop (but always crashes after 5,5 hours).
Before any measurement the counters are reset an configured.
I attached a piece of my software with setup and measurement routine...
 
Is there any help ?
 
Thanks, Mike
0 Kudos
Message 1 of 2
(2,895 Views)
I don't see where you ever free this allocation:

FreqFeld[k] = malloc((MaxAnzWerte+4)*sizeof(double));


Every malloc / calloc should be matched by a free or else you're leaking memory and you'll crash if you run long enough.


malloc's come off the heap, as do statically defined variables. Everything else is on the stack, and you didn't get a stack overflow error.

Bob
0 Kudos
Message 2 of 2
(2,867 Views)