LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory leak

Hi all,

I have written a software with Labwindows CVI and the memory grows and grows up in 4k steps.

After this i replaced all *alloc from my code, so I got no dynamic memory reservation, but it still grows up in 4k steps!

Next I did, I removed every GUI things from my programm. Now it grows still up in 4k steps, but not as fast as with the GUI.

From the given HeaderFiles I use theese ones:

#include <rs232.h>
#include <snmp.h>
#include <winsock.h>
#include <cvintwrk.h> 
#include <stdio.h>
#include <windows.h>
#include <tcpsupp.h>
#include <userint.h>
#include <utility.h>
#include <ansi_c.h>
#include <cvirte.h>       
#include <formatio.h>
#include <dataskt.h>
#include <MgmtAPI.h>
#include <Snmp.h>
#include <stdlib.h>


and theese libraries:

MgmtAPI.LiB
MPR.LIB
SnmpAPI.Lib



is out there any idea where my leak can be? Some Problems have had wit one of theese Libraries/Headers before? Where is it neccessary to free something after use a given function? Is there an Labwindows CVI memory leak detactor? everyone I found is only for visual studio 😞

thanks for HELP!!!
0 Kudos
Message 1 of 4
(4,606 Views)
Hello marco_a,

there are no known general memory leaks in the include files and libraries you mentioned.

However, it is relatively easy to generate leaks with functions in winsock etc. if the respective functions are not handled correctly.
Unfortunately, there is no profiling tool for LabWindows/CVI. You will have to step through your program and watch in Task Manager in which part of your code the memory is allocated.

I hope this helps getting you started.

Regards,
Johannes

AE, NI Germany
0 Kudos
Message 2 of 4
(4,587 Views)
this helps unfortunately not, because the memory grows up on different places on different times. The software is a big loop which repeats it's work and it isn't a reproducibly error, because the memory is the same for 3-4 loops of the program and for example at the 6th or 10th loop the memory grows up for 4k o_O
0 Kudos
Message 3 of 4
(4,584 Views)

Hello marco_a,

I know you mentioned that you have removed all dynamic memory allocations, but you may still want to try adding various calls to the CVIDynamicMemoryInfo function to see if it identifies any additional memory allocations/handles you may not be closing.

From the function panel:

CVIDynamicMemoryInfo determines the total number of memory blocks allocated and the total number of bytes allocated.

In addition, the function can display this information and additional information for each individual memory block in the debug output window.

Thanks

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 4
(4,484 Views)