LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

NIReport memory leak ?

Hi all,
I am getting some unreleased memory from the NIReport library using the code below.
Since I do not have the code of Nireport, I cannot see where the problem is coming from.
The main problem I have is that the leak is cumulative : X Bytes * number of call of GetAndFreePrinters.

Can anyone help ?
My Config is Meaurement Studio 6.0 FDS on Windows 2000.

Thanks in advance,
Farid.




#include "nireport.h"
#include
void GetAndFreePrinters (void);

void main()
{
GetAndFreePrinters();
CVIDynamicMemoryInfo ("Memory Content", NULL, NULL, DYNAMIC_MEMORY_SHOW_ALLOCATED_MEMORY);
}

void GetAndFreePrinters(void)
{
//From the Help of the function NIReport_GetPrinters

char **allPrinters;
char **printer;


NIReport_GetPrinters (NULL, &allPrinters);
printer = allPrinters;
while (*printer != NULL)
NIReport_FreeMemory (*printer++);
NIReport_FreeMemory (allPrinters);
}
Message 1 of 4
(3,648 Views)
Hello,
I ran your code in a loop that iterates 100 times, but I did not see any memory increase. I used CVI 6.0 on Windows XP...
0 Kudos
Message 2 of 4
(3,648 Views)
hi there,
Thanks for the info.
Could you try on a W2k box? (I am using SP3)
0 Kudos
Message 3 of 4
(3,648 Views)
Hi,
I have just retried and confirmed the problem (w2000 SP3 + MStudio FDS 6.0).
See the attached project.
On the Debug Window I am getting an unreleased memory block of 160 Bytes at each iteration.

Thanks in advance,
Farid.

Memory unreleased : 1 blocks ( 160 Bytes)
Memory unreleased : 2 blocks ( 320 Bytes)
Memory unreleased : 3 blocks ( 480 Bytes)
Memory unreleased : 4 blocks ( 640 Bytes)
Memory unreleased : 5 blocks ( 800 Bytes)
Memory unreleased : 6 blocks ( 960 Bytes)
Memory unreleased : 7 blocks ( 1120 Bytes)
Memory unreleased : 8 blocks ( 1280 Bytes)
Memory unreleased : 9 blocks ( 1440 Bytes)
Memory unreleased : 10 blocks ( 1600 Bytes)

Dynamic Memory Information: Memory Content
Total number of bloc
k allocated: 10
Total number of bytes allocated: 1600
Block# Address Size Values
0 017b0068 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
1 017b0110 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
2 017b01b8 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
3 017b0260 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
4 017b0308 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
5 017b03b0 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
6 017b0458 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
7 017b0500 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
8 017b05a8 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
9 017b0650 160 45 70 73 6f 6e 20 53 74 79 6c 75 73 20 43 4f 4c
0 Kudos
Message 4 of 4
(3,648 Views)