LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory leak in Toolbar.fp of CVI 8.0.1

Hi,

using CVIDynamicMemoryInfo() I found some allocated memory blocks when my application terminates.

I was able to trace the problem down to the Toolbar.fp.

The calls of Toolbar_New() followed by Toolbar_Discard () cause the following printout:

Dynamic Memory Information: End of Execution
Total number of block allocated: 7
Total number of bytes allocated: 184
Block#    Address     Size        Values
      0    01cd0068          24    00 00 00 00 03 00 00 00 02 00 00 00 e8 00 cd 01
      1    01cd00b0          32    54 53 49 4c 0a 00 00 00 04 00 00 00 00 00 00 00
      2    01cd00d8           8    d0 02 cd 01 44 00 00 00
      3    01cd00e8           8    b0 00 cd 01 1c 00 00 00
      4    01cd00f8          32    54 53 49 4c 0a 00 00 00 04 00 00 00 00 00 00 00
      5    01cd0120           8    f8 00 cd 01 1c 00 00 00
      6    01cd02d0          72    54 53 49 4c 0a 00 00 00 04 00 00 00 05 00 00 00
 
Thats not a dramatic issue for me, because I only use a single toolbar in my application, but it might sum up i someone uses many toolbars lets say in a lot of child panels. Unfortunateley in CVI 8.0 the toolbar.c is not part of the delivery so I'm unable to go into more details. Maybe someone at NI can take a look. There was a fromer post in this forum (i guess it was from 2001) that describes the same problem in CVI 5.5 and 6.0, maybe a good time now to remove the issue...

0 Kudos
Message 1 of 3
(3,304 Views)

The CVI 8.0 toolbar keeps some global information around for coordinating multiple toolbars. This data is cleaned up in an atexit() function and will not be freed when all toolbars have been discarded. This memory should not grow except slightly as you add more toolbars to your program.

Hope this helps,

-alex

0 Kudos
Message 2 of 3
(3,301 Views)
Alex thanks for your quick response.
I understand what you wrote and obviously it is not a real memory leak that could grow over time. The only thing to criticize is that this bahaviour is not "nice". I consequently try to make my applications memory leak free because they are usually running continuously for a long time (over several weeks) so the effects of a leak may sum up to a reasonable amount. I found it very convenient to use CVIDynamicMemoryInfo() for that purpose during debugging. But now with the toolbar "leak" ist is harder for me to distinguish between "real" leaks I generated in my code and "dummy" leaks generated by toolbar.fp. Even with the registration of an additional atexit() called after the toolbar-atexit there are five memory blocks remaining. I can imagine that there could be a way to avoid this deranging behaviour.
 
Torsten
0 Kudos
Message 3 of 3
(3,280 Views)