Showing results for 
Search instead for 
Did you mean: 

tool tip memory leak

Go to solution
I seem to have a memory leak associated with tool tips.  When ever I place the mouse over a panel using tool tips I cas see the dynamic memory usage continuously increasing.  If I comment out the call to the tool tip functions (i.e. SetCtrlToolTipAttribute), the memory leak dissapears.
0 Kudos
Message 1 of 11

Hi JoeKenZ,


There was a memory leak that was fixed in CVI 8.5. Are you using an older version than that?



0 Kudos
Message 2 of 11
Yes, 8.0.0.  Thank you.  Is there a fix?
0 Kudos
Message 3 of 11
Accepted by topic author JoeKenZ

There's no patch for 8.0.0, if that's you mean.


But since the Programmer's Toolbox is open-source, you can easily fix it yourself:


In line 3365 of the 8.0.0 version of C:\Program Files\National Instruments\CVI80\toolslib\toolbox\toolbox.c, you need to add the following ListDispose function call:


if (RectContainsPoint (bounds, point))
    PointConvertCoordinates (panel, child, &point, FALSE);
    ListDispose (sortedChildren);
    return PointToPanel (child, point);


After you make the change, you'll need to recompile the file (Options>>Create Object File) to regenerate the object file, and then restart CVI.



Message Edited by LuisG on 03-23-2009 11:31 AM
Message 4 of 11

Beautiful, thank you.

0 Kudos
Message 5 of 11
>     ListDispose (sortedChildren);

Interesting. And important for the program I'm on which will run for months
non-stop !

But... how do I recompile toolboc.c on Linux ? Using cvicc ? gcc ?
Guillaume Dargaud

0 Kudos
Message 6 of 11



This command line should work (called from the root cvi directory)

gcc -fPIC -O2 -D_REENTRANT -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I./include -I./toolslib/toolbox-I./toolslib/custctrl/custsupp toolslib/toolbox/toolbox.c -o toolslib/toolbox/toolbox.o


You will also need write access to the CVIDIR/toolslib/toolbox directory for the command to succeed.


I don't think any of the defines are really required, but they are in the makefile we used to build the original object.


Also calling cvicc toolbox.c should probably work, but I can't currently test it.




0 Kudos
Message 7 of 11
Thanks, that's important to know. I will test it some some time next week
(other priorities first!)
Guillaume Dargaud

0 Kudos
Message 8 of 11

Hello Michael,

I just tried to recompile the toolbox, but here's what I get. Something must have changed between version 8 and version 2010...

$ cd /usr/local/natinst/cvi2010; sudo chown -R someuser .
$ gcc -fPIC -O2 -D_REENTRANT -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I./include -I./toolslib/toolbox -I./toolslib/custctrl/custsupp toolslib/toolbox/toolbox.c -o toolslib/toolbox/toolbox.o
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
/tmp/ccULcfdP.o: In function `CVIAbsoluteTimeFromCNVTime':
toolbox.c:(.text+0x2154): undefined reference to `CVIAbsoluteTimeFromTimeUnit'
/tmp/ccULcfdP.o: In function `CVIAbsoluteTimeFromCVIANSITime':
toolbox.c:(.text+0x21c9): undefined reference to `CVIAbsoluteTimeFromTimeUnit'
/tmp/ccULcfdP.o: In function `CVIAbsoluteTimeToCNVTime':
toolbox.c:(.text+0x2257): undefined reference to `CVIAbsoluteTimeToTimeUnit'
/tmp/ccULcfdP.o: In function `CVIAbsoluteTimeToCVIANSITime':
toolbox.c:(.text+0x22f0): undefined reference to `CVIAbsoluteTimeToTimeUnit'
/tmp/ccULcfdP.o: In function `CVIAbsoluteTimeFromCVIUILTime':
toolbox.c:(.text+0x237b): undefined reference to `GetDateTimeElements'
toolbox.c:(.text+0x23e5): undefined reference to `CVIAbsoluteTimeFromLocalCalendar'
/tmp/ccULcfdP.o: In function `CVIAbsoluteTimeToCVIUILTime':
toolbox.c:(.text+0x2495): undefined reference to `CVIAbsoluteTimeToLocalCalendar'
toolbox.c:(.text+0x24e0): undefined reference to `MakeDateTime'
/tmp/ccULcfdP.o: In function `PostDeferredCallToThreadAndWait':
toolbox.c:(.text+0x25a8): undefined reference to `CmtGetCurrentThreadID'
toolbox.c:(.text+0x25cc): undefined reference to `Timer'
toolbox.c:(.text+0x25e8): undefined reference to `PostDeferredCallToThread'
toolbox.c:(.text+0x2607): undefined reference to `Timer'
/tmp/ccULcfdP.o: In function `ToolBoxAtExitFunction':
toolbox.c:(.text+0x2bed): undefined reference to `CVIRTEHasBeenDetached'
/tmp/ccULcfdP.o: In function `DelayQueueDispose':
toolbox.c:(.text+0x2c73): undefined reference to `DiscardCtrl'
toolbox.c:(.text+0x2c88): undefined reference to `DiscardPanel'
/tmp/ccULcfdP.o: In function `FreeThreadLocalResourcesCallback':
toolbox.c:(.text+0x2ce4): undefined reference to `DiscardPanel'
/tmp/ccULcfdP.o: In function `ComparePanelZPlaneOrder':
toolbox.c:(.text+0x2daa): undefined reference to `GetPanelAttribute'
toolbox.c:(.text+0x2dc6): undefined reference to `GetPanelAttribute'


0 Kudos
Message 9 of 11

Oops, I missed a very important option. You need to add a '-c' to the gcc command line to tell it to just compile the c file and not try to link it into an executable. Anywhere on the command line should be fine, but I would put it right before the '-o toolslib/toolbox/toolbox.o' part of the command line.




0 Kudos
Message 10 of 11