LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory leak using tooltips on child panel

I noticed the memory used by my program was increasing at about a once per second rate. Then I noticed it would only increase when the mouse was over a child panel with some indicators on it. The indicators were all created using the DuplicateCtrl function and tooltips assigned using SetCtrlToolTipAttribute. I then created a short program to verify that it was the tooltips causing the problem.  Is this a bug or am I using tooltips wrong? Here is my test program (also attached).
#include "toolbox.h"
#include <cvirte.h>       
#include <userint.h>
#include "ttmemleak.h"

static int hMain, hTestPanel;

void CreateIndicators(void);

int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                       LPSTR lpszCmdLine, int nCmdShow)
{
    if (InitCVIRTE (hInstance, 0, 0) == 0)
        return -1;    /* out of memory */
    if ((hMain = LoadPanel (0, "ttmemleak.uir", MAIN)) < 0)
        return -1;
    if ((hTestPanel = LoadPanel (hMain, "ttmemleak.uir", TESTPANEL)) < 0)
        return -1;
    DisplayPanel (hMain);
    DisplayPanel(hTestPanel);
   
    CreateIndicators();
       
    RunUserInterface ();
    DiscardPanel (hMain);
    return 0;
}

int CVICALLBACK MainHandler (int panel, int event, void *callbackData,
        int eventData1, int eventData2)
{
    switch (event)
    {
        case EVENT_GOT_FOCUS:

            break;
        case EVENT_LOST_FOCUS:

            break;
        case EVENT_CLOSE:
            QuitUserInterface (0);
            break;
    }
    return 0;
}

void CreateIndicators(void)
{
    int i, iTop = 10, iLeft = 50, iCtrlID;
    char szBuff[40];
   
    for(i=1; i<=80; i++){
        iCtrlID = DuplicateCtrl (hMain, MAIN_NUMERIC, hTestPanel, "", iTop, iLeft);
        sprintf(szBuff,"Tooltip #%d",i);
        SetCtrlToolTipAttribute(hTestPanel,iCtrlID,CTRL_TOOLTIP_ATTR_TEXT,szBuff);
        iTop+=20;
        if(i%20==0){
            iLeft+=100;
            iTop = 10;
        }
    }
}
I have a numeric control on the MAIN panel and am duplicating it 80 times on the child TESTPANEL panel.
Using CVI 8.1.1 on XP.
0 Kudos
Message 1 of 4
(3,232 Views)
 
Thank you for reporting this, and for making an independent test program that shows this behavior.  I also see this behavior.  This was reported to R&D  for further investigation.  Thanks for the feedback!
Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 2 of 4
(3,211 Views)
Hi.
 
I noticed the same trouble with CVI 8.1.1. it seems that this trouble is solved with CVI 8.5, could you confirmed me ?
 
thank you
 
Jean Philippe
0 Kudos
Message 3 of 4
(2,908 Views)

hello

it's me again. I found the answer this bug is fixed with CVI 8.5

http://zone.ni.com/devzone/cda/tut/p/id/6545#toc10

jp

0 Kudos
Message 4 of 4
(2,906 Views)