From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read jpg file in a loop

Solved!
Go to solution

Hi All,

 

I have simple labview code which has a memory leak.

 

I am creating the file path to the jpg file, and then using the Read JPEG file.vi and Draw Flatten PixMap.vi to display the image.

 

How can I do this without leaking memory?

 

In the future, I will have another application which updates the file every so often. I will use some sort of control to stop reading/writing to the file at the same time.


Please help,

 

James 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 1 of 7
(3,680 Views)
Can you post a screen shot to show where the mem leak is? Do you have VDM(vision development module)?
Message 2 of 7
(3,664 Views)

Hi James

 

I just tried it here in 8.5.1 and a don't see memory leak.

 

I am going to guess that you may have the picture data in a shift register and feeding the previous iteration into Draw Flattened Pixmap picture input. Have a look inside Draw Flattened Pixmap. Its basically concatentating strings which may be your the leak you are seeing.

 

cheers

 

David

Message 3 of 7
(3,645 Views)

Hi everyone - thanks for the replies.

 

My simple mock up of the issue looks like :

 

Capture.PNG 

The LabVIEW.exe memory increases by 5,000k per iteration of the loop. This is concerning.

 

Is this to be expected?

Can it be avoided?

Should I consider another apporach?

 

PS I do not have the VDM.  

 

THANKS!

James 

Message Edited by Hillman on 03-27-2010 11:29 AM
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 7
(3,628 Views)
Solution
Accepted by topic author Hillman

Hi James,

i think the reason is, that you use a shift register. The "Draw Flattened Pixmap" functions adds the new image every iteration to the old one.

 

Mike

Message 5 of 7
(3,625 Views)

Thanks mike! That worked  - obviously. I felt like I must have been missing using the VI.

 

Have a great weekend,

 

James  

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 6 of 7
(3,620 Views)

Thanks a lot

 

You recomadation working for me.

 

Best Regards

 

 

0 Kudos
Message 7 of 7
(2,772 Views)