LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EasyTab_ConvertFromCanvas - memory leak?

I am using the EasyTab_ConvertFromCanvas to load tabs onto a panel.

However, when using DiscardPanel, memory is never released according

to the resource tracker.

 

See attached example, if the call to EasyTab_ConvertFromCanvas

is commented out, memory is released using DiscardPanel.

 

We are using the CVI 9.0.1 RTE and tried the CVI 9.0 and 9.0.1

compilers.

 

Has anyone experienced this?

 

Thanks. 

0 Kudos
Message 1 of 11
(4,852 Views)

Hi kcliche,

 

 

I was able to reproduce this behavior and it has been reported to R&D (#197837) for further investigation. One thing that you may want to look into is using the native tab control that can be accessed through the Control menu when you create your GUI. Thanks for the feedback!

Cheers,
Kelly R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 11
(4,798 Views)
Call the undocumented EasyTab_RevertToCanvas() before DiscardPanel().
-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 3 of 11
(4,790 Views)

I have added the following to the attached example project and still see memory not being released

in the resource tracker.

 

  DisplayPanel (iPanelHandle);
  RunUserInterface ();
  EasyTab_RevertToCanvas(iPanelHandle, PANEL_CANVAS);
  DiscardPanel (iPanelHandle);

Is this correct?

 

Thanks,

 Kevin

0 Kudos
Message 4 of 11
(4,774 Views)

Hi Kevin,

 

Upon looking at this closer I do not think that there is actually a memory leak.  When I first ran through it with the resource tracker, I saw I had a Thread-local variable and a List type remaining, which I think is what you saw.  I found later that if I right-clicked on these to select "Break on Deallocation", and closed TestStand, I saw where this memory was being released.  You can test this as well by including easytab.c and toolbox.c and making the selection that I had mentioned.  Please let me know if you are seeing something else.

Cheers,
Kelly R.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 11
(4,734 Views)
Hello,

I have also seen this behaviour some time ago (I'm not sure, but I was probably using CVI 7.0 at that time).
I don't know if this is a memory leak or a forgotten "free" or whatever you would like to call it, but that's quite annoying when trying to look for a forgotten "free".

I'm using CVI to develop/enhance an application which includes many tabs (at least 7 tab systems with a dynamic number of tab in each) using EasyTab (and converted canvas), and it's quite difficult to find a forgotten "free" (at least using CVI 8.5 and CVIDynamicMemoryInfo) because there is allways something remaining in memory when the main function ends.

If someone at National Instruments could solve this behaviour, that would be very interesting (using the suggested non-documented function EasyTab_RevertToCanvas doesn't do the trick for me neither).

Regards,
Frédéric Lochon.
0 Kudos
Message 6 of 11
(4,718 Views)

Hi Kelly R,

 

Yes, when trying what you suggest I see a thread variable and a list type left

over in the resource tracker (attached in image).

 

I would have thought that if in the resource tracker, it did not state "There are

no allocated resources" then something is wrong.

 

We are currently in the process of investigating random crashes and are trying

to detect and eliminate all leaks.

 

Can it be certain that this is not a leak?

 

Can we assume that if the resource is not in the memory tree of the resource

tracker it is not a leak?

 

Regards

0 Kudos
Message 7 of 11
(4,706 Views)

Hi Kevin,

 

I am certain that this is not a memory leak.  I think the issue is the memory is just not being released where you expect.  Again, it is helpful to select "Break on Deallocation" as I had mentioned in my previous post so you can see exactly where this memory is being released.  Remember you need to close TestStand to finish your debugging session.  A memory leak only exists when a resource is left in the resource tracker after this debugging session is ended. 

 

Also the EasyTab_RevertToCanvas function that others have mentioned is not required to release any memory.  This function was used before we created the native tab control on the GUI, and it was used to convert the control back to a canvas control when the user exits operate mode in the UI Editor. I hope this clarifies things.

Cheers,
Kelly R.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 11
(4,662 Views)

This thread is very old, but I am seeing the exact same thing now.  I feel like I haven't seen this before, but when updating an older program it occurs.  I'm using CVI2010 with Resource Tracking.

 

Following all previous advice, it looks like the memory left open is there from calling EasyTab_LoadPanels(..)

Discarding individual panels, calling RevertToCanvas, discarding the Ctrl, and discarding the main panel do not solve this.

 

"Multithreading library->Thread-local variable 1" is always left open along with a "Toolbox-> List Type 0x####"

 

This causes a Fatal Run-Time Error with an unknown fault EVERY TIME I run my program in the IDE.

 

 

 

 

 

0 Kudos
Message 9 of 11
(3,936 Views)

Hi ngay528,

 

I would suggest creating a new thread with a fresh description of your issue and a link to this thread.

 

Are you using the same code that was provided in the original post? It would also be beneficial to know at what point the Fatal Run-Time Error occurs. I assume you are unable to the "Break on Deallocation" step suggested by Kelly_R because of the error, is that correct?

Steven Gloor
Staff Customer Engineer - CTA, CLD
0 Kudos
Message 10 of 11
(3,912 Views)