QControl Enthusiasts

cancel
Showing results for 
Search instead for 
Did you mean: 

QControl memory leak?

Solved!
Go to solution

Hi,

first of all, thank you very much for QControls.

 

I have got a project, where I use QControls. I have a bunch of VIs using QControls starting without an open frontpanel.

From time to time these VIs get displayed in subpanels.

 

After a while I found out, that my project has a problem with memory leak.

I searched a while and found out, that it stopped after I opened all VIs which used QControls once.

 

 

At first I thought it was a wrong implementation from one of my QControl functionality but I couldn't find anything.

 

After a while and a lot of searching I dived into the Event Handler Dispatcher.vi and figured out, that the reference of "Control in" registers a new event every 10 milliseconds until the frontpanel opens, without using it. The while loop analyses the error output, until the event registration doesnt fails anymore. After that, only the last event registration gets destroyed. All other references get kept in memory and keep growing, if the frontpanel do not get opend.

 

Is there any reason for keeping the event registration references in memory?

If not, I suggest to destroy every single event registration reference, after evaluating the error, even if the registration fails.

 

old.PNGold

My change:

new.PNGnew

 

I did this modification and now, everything is fine.

It would be nice to fix it in the QControl Toolkit.

 

greetings

bheemann

Message 1 of 4
(3,412 Views)

I remember you sent me a message about this a while ago. I apologize, I have implemented your fix in the next release but I have not got it out the door as yet.

 

An explanation to other users: you will want to implement @bheemann's fix if you launch a VI owning a QControl but don't immediately show it (i.e. launch the VI and at a later time show the VI in a subpanel). 

 

The VI shown checks that the front panel of the VI owning the QControl is open before launching the event handler.  This keeps the dynamically called events in the event handler from causing an error on registration.  If the front panel of the VI owning the QControl is opened immediately then only one reference is created and it is closed.  The problem arises when the front panel of the VI owning the QControl is not opened immediately; then many references are created but only the last one is closed.

 

As I said, I'll have this fixed in the next release.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 2 of 4
(3,399 Views)
Solution
Accepted by TheQ

Thanks for the quick reply.

I posted that to keep things in mind and let people know about the issue.

Just in case someone have the same problem like me.

Everything else works out very well!

 

You only have to keep in mind that the fix is important every time you set up a new development environment.
That cause raised my attention concerning the issue again. 😉

0 Kudos
Message 3 of 4
(3,391 Views)

And thank you for post here to keep it on my to do list.

 

Feel free to mark your post a the solution too as you were both the question and the fix. 

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 4 of 4
(3,387 Views)