LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

memory leak with File Write.vi

Hi All,
 
I am trying to save a big data cluster, which includes images, into a data log file. The vis I use are: New File.vi, Write File.vi, Close File.vi.
 
 
The problem is Write File.vi has memory leak  when the data cluster includes images .
 
 
Anyone sees similar case?  Any solution?
 
Thanks.
 
Aiqiu
0 Kudos
Message 1 of 9
(3,210 Views)
What type of image data are you trying to store in your cluster? Is this a LabVIEW picture data type, or the Image Data data type? Is this a binary representation of a bitmap file?
 
Also, what version of LabVIEW are you using currently?

Message Edited by Jarrod S. on 02-24-2006 02:10 PM

Jarrod S.
National Instruments
0 Kudos
Message 2 of 9
(3,189 Views)
Hi,

It's a IMAQ color image, RGB U32.  And I am using Labview  7.1.1.

Thanks.

Aiqiu

0 Kudos
Message 3 of 9
(3,177 Views)
Can you post a small example VI that demonstrates this behavior?
Jarrod S.
National Instruments
0 Kudos
Message 4 of 9
(3,151 Views)

Sure. Here it is.

0 Kudos
Message 5 of 9
(3,144 Views)

This has been reported to R&D (# 3UR8IEV2) for further investigation. I will forward this information to our IMAQ team for a possible workaround. Thanks for the feedback!

Jarrod S.
National Instruments
0 Kudos
Message 6 of 9
(3,129 Views)
I tried a possible workaround, first flatten the data cluster to string, then save the string. It seems working OK.

For reading, needs to read the string first, then unflatten to data cluster.


Thanks a lot for the help.

Aiqiu
0 Kudos
Message 7 of 9
(3,119 Views)
Aiqiu,
 
I am glad you found out about flattening your image to a string.  I was about to post and say that you probably didn't want to save the IMAQ image reference to a file, because after you closed the image in memory, there wouldn't be anything for the IMAQ image reference to point to.  You are correct to flatten the image to a string.  Below is a link to a document which discusses doing this to communicate over datasocket, but the processes of flattening the image to a string is the same regardless of whether or not you are sending the image across a datasocket connection or saving to a file.
 
 
As for the memory leak.  I am pretty sure that if you passed all of the IMAQ Image references created in the "Image Init Buffer.vi" subVI and then closed each reference individually, that the memory leak would probably go away.
 
Lorne Hengst
Application Engineer
National Instruments
Message 8 of 9
(3,101 Views)
Thank you for your reply. Just some clarification.
 
I was about to post and say that you probably didn't want to save the IMAQ image reference to a file, because after you closed the image in memory, there wouldn't be anything for the IMAQ image reference to point to. 

* I want to save the image not the reference. I save the cluster into file before I close the image reference. It still works except the memory leak.


As for the memory leak.  I am pretty sure that if you passed all of the IMAQ Image references created in the "Image Init Buffer.vi" subVI and then closed each reference individually, that the memory leak would probably go away.

* The memory leak happens  when the program is while looping.  I could not close the image refrence in the while loop since I want to reuse it. Otherwise for each loop, I need to create and dispose images.

Aiqiu
0 Kudos
Message 9 of 9
(3,089 Views)