LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EasyTab memory leak

I am using CVI/Labwindows 5.0.1 on WinNT 4.0 and Win2000. I am using the easytab control.

When the displayed code is started 1544 bytes is allocated.
When the code the has discareded both the tab and the panel 132 bytes is left. Only discarting the panel would lead to the same results.

How can i fix this. There must be an error in the easyt tab code.
I also have a more complicated code in which i discovered the problem, but even this simple code displays the same problem.



///////////////////////////////////////////////////////
#include /* Needed if linking in external compiler; harmless otherwise */
#include
#include "Tabs.h"
#include "Easytab.h"

static int panelHandle;
static int Tab1;
static int Tab2
;

static int Tab;

int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "Tabs.uir", PANEL)) < 0)
return -1;
if ((Tab1 = LoadPanel (panelHandle, "Tabs.uir", TAB1)) < 0)
return -1;
if ((Tab2 = LoadPanel (panelHandle, "Tabs.uir", TAB2)) < 0)
return -1;

Tab = EasyTab_ConvertFromCanvas(panelHandle, PANEL_CANVAS);
EasyTab_AddPanels (panelHandle, Tab, 1, Tab1, 0);
EasyTab_AddPanels (panelHandle, Tab, 1, Tab2, 0);



DisplayPanel (panelHandle);
RunUserInterface ();
return 0;
}

int CVICALLBACK PanelEvent (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:
DiscardPanel(Tab);
//DiscardPanel(Tab1);
//DiscardPanel(Tab2);
DiscardPanel (pane
lHandle);


QuitUserInterface (0);
break;
}
return 0;
}
///////////////////////////////////////////////////////


Thanks,


Sebas
0 Kudos
Message 1 of 3
(3,092 Views)
Sebas,
Actually, I'm seem to recall an issue similar to this before in CVI with the easytab controls. Let me look into this a bit, and talk to a few people, and get back to this post for an answer to see if this is in fact a memory leak. Thanks.
0 Kudos
Message 2 of 3
(3,092 Views)
I discovert the "problem" is with the chainctrl and chainpanel functions. These allocate the memory.

I my advanced program I discoverd that there is a other amout of bytes left. In this problem the GUI (the panels) and code work separately. So I can open en close the panels with shuttting down my program. It seems that the bytes that are left stay the same after several restarts (open and than dispand) of the GUI. They don't increese by some amout every restart. This would show that's is not a memory leek but that it is memory that is released upon the quituserinterface command since then the event loop (and so also the chaincontrol definitions) will be destoyed.

This is what I think happends, after only 5 months of CVI experiance and lots of reading.

I h
ope that the think you find out will say the same. I desperately waiting for an answer, since I shout deliver the product this week.

thanks for your help,

Sebastiaan
0 Kudos
Message 3 of 3
(3,092 Views)