LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Leak with Picture Control

Hi all
 
There is bug with Picture Control
When you insert you picture data in loop into the shift register, memory leak
 
Can somebody to prevent this bug?
 
Run attached example and look at Task Manager
0 Kudos
Message 1 of 8
(3,662 Views)

Its expected behaviour in your implementation. You keep appending the image which means the picture continues to grow. Thats why you have a memory leak.

David

Message 2 of 8
(3,656 Views)

I believe David properly called the cause of this memory consumption.

In reply # 52 of thsi thread,

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=5&jump=true

I posted an example that inserts 130 FP object images in a picture and moves them around (it is a random walk where each object is assigned a letter and the program terminates when all of the letters required to spell out "Hello World" wander into the trap at the bottom.)

A snippet of the code follows.

A) Start with a blank picture

B) Inster all of the images

C) show the updated image.

Other links to LV Picture control examples can be found in this thread.

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=14&jump=true

Ben

 

Message Edited by Ben on 01-14-2007 08:58 AM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 8
(3,647 Views)


@nadav Chernin wrote:
Can somebody to prevent this bug?

Just replace the shift register with a plain tunnel and place the "get image" node inside the loop. 🙂 (This is the solution if the string might change during run and you want to see the current image.)

.... Of course since the "get image" node is currently outside the loop, it will run exactly once and nothing will ever change inside the loop. You might as well delete the loop entirely. Right?

0 Kudos
Message 4 of 8
(3,624 Views)

Hi, David

I don't think that i just append new picture to old picture as to concatinate 2 strings. I think that LV implement it as replace area of old picture by new picture.

Look attached example that continue to append picture but memory don't leak

0 Kudos
Message 5 of 8
(3,600 Views)
Except that your last code does absolutly nothing that is useful and couldn't be done without loop and shiftregister at all and indeed does not leak any moeory there is a very big difference to your original VI. In there you do append a new picure each time to the existing picture. You do not see any effect because they are all the same and the Picture control rendering is way to fast to let you see that it actually draws the same picture one more time after each loop iteration.
 
Rolf Kalbermatter

Message Edited by rolfk on 01-15-2007 11:32 AM

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 8
(3,596 Views)

If you need to be convinced then take a look inside the Draw Flattened Pixmap.

David

Message Edited by David Crawford on 01-15-2007 10:42 AM

Download All
0 Kudos
Message 7 of 8
(3,590 Views)

Nadav,

Inside your loop (of your original example) branch the wire coming for the shift-register to a "flatten to string" then get the sring length returned and display it on your FP.

You will see that the amount of data in the SR grows with each interation.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 8
(3,570 Views)