LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

memory leak with variant/OCX

I'm trying to get images from an IP webcam thanks to an ActiveX and process them with IMAQ.
This ActiveX needs a variant to put chars from the image. It seems to work fine, (nearly 'in real-time') when I convert a string into a variant. Nevertheless, I have memory leak, if I put this sub-VI into a while loop.
So, rather than using a string conversion, I've tried to use a Uchar array conversion. It also seems to work but it is really slow and in this case I don't have any leak of memory !

I'm likely misunderstand the memory managment of Labview.
Thank you very much for your help.
0 Kudos
Message 1 of 9
(2,942 Views)
Assuming that there isn't a memory leak in the activex object you're accessing (a very real possibility), you are probibly not closing a reference--though there could be something about how you are doing the conversion that is causing the problem. If you post your code I could get a better idea.

In the mean time, you might want to consider getting into the habit of routinely closing any references you open. Sometimes a close isn't required, but attempting to close a reference when the close isn't needed doesn't hurt anything.

Note that if you read a property that returns a reference (or an array of references), or invoke a method that returns a reference, those references definately need to be explicitly closed.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 9
(2,942 Views)
I've tried to close the reference but without any success.
The activex object may not work very well, but what I don't understand is that when I'm using an array of UChar, it works but very slowly and when I'm using string, I have memory leak but with "real time".

Hear are the code.

Thank you very much again for your help

Olivier M.
Download All
0 Kudos
Message 3 of 9
(2,942 Views)
I don't see anything here that should cause a memory leak, but there seems to be a subvi missing. Is this the Uchar version of the one with the leak?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 9
(2,942 Views)
Sorry for the VIs I've sent.

Here are simplified VIs, with comments that illustrate the problem.
I hope this will bring you clearer informations.

Olivier M.
Download All
0 Kudos
Message 5 of 9
(2,942 Views)
On a bazaar remote chance, wire the data from your variant to data functions to the edge of the case structure in SnapAxis.vi. Also can you create a constant of the variant that goes to the variant to data function so we can see the memory leak too. What version of LabVIEW are you using?
0 Kudos
Message 6 of 9
(2,942 Views)
Strangeness! Nothing that I can see should be causing your problem, but it looks like you have attracted the attention of Jeremy--which is a good thing. He works for NI and has access to information we don't. I would say follow up with him...

And be sure to let us know what you find.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 9
(2,942 Views)
I'm using Labview v6.1.
I've tried to follow your advice, but without any success.
I've put an indicator after the ActiveX, the variant VImage looks like :

Value -> Array(Non Displayable)

Nevertheless the "variant to data" function enables me to get the pixels.

Here is a capture of memory behaviour during the program run.
0 Kudos
Message 8 of 9
(2,942 Views)
OK, I've just received CDs of Labview 7, and now it works very well with Variant to String converter, without any memory leak.

thank you for your help.
0 Kudos
Message 9 of 9
(2,942 Views)