LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Picture Control Memory Growth

Solved!
Go to solution

Okay so the 2D Picture data type is really a string.  It is a series of operations to draw an image basically.  So it is like putting a picture over top of a picture as you draw new things, and as a result the memory increases because all of the previous layers no longer able to be seen, are still in memory.

 

Attached is a quick example of this.  Run the VI then move the first slider back and forth.  Notice that the String Length continues to grow even if parts of the image are being covered up.

 

My question is this.  What is the easiest way to fix this issue?  I have a case where I have an image already drawn and it is fine, but I want to update just one section of it (like this VI).  But if I do so over and over the memory grows forever.  

 

I could redraw the whole picture every time but I want this to be quick and I'm unsure how big my picture will be, I just know to update a subset of the image based on the pixel location.  

 

I could also convert it to a pixmap and back which seems to work, but is this the right way to do this?  Thanks.

0 Kudos
Message 1 of 7
(3,755 Views)

The way I have delt with this in the past is draw one image that is essentially static and then use this drawing as the basis for drawing the dynamic parts of the picture. The idea is to draw the stuff that doesn't change once and then use that as a basis for future drawing so you don't have to redraw everything everytime.

 

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 7
(3,753 Views)

In my situation nothing is static.  Imagine it like my demo VI where each block is a picture, and each picture could be redrawn for various reasons.

0 Kudos
Message 3 of 7
(3,750 Views)
0 Kudos
Message 4 of 7
(3,746 Views)
Solution
Accepted by Hooovahh

Ok, then a modification of the idea. Each section draws a picture consisting of just its stuff. Those subdrawings only change when the values that define them change. Then combine all the subdrawings together at the last instant before display.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
Message 5 of 7
(3,745 Views)

Yeah that'll work, it'll mean more thing in memory to worry about but its probably better this way.

0 Kudos
Message 6 of 7
(3,737 Views)

I did a real nice OO implementation of this kind of drawing once. Each section of the drawing was an object that updated itself as needed. Worked real well...

 

Mike...

 

PS: the drawings in Christian's post are for Hooovahh Dam Leakage Smiley Very Happy


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 7
(3,732 Views)