LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV 8.5 Memory Leak with String Networked Shared Variables

I am seeing a memory leak on the PC using string networked shared variables. Some time ago, we experienced a leak using string networked shared variables on an RT machine, and the fix for that came out in LV 8.5.1. This new leak, however, is on the Windows PC.

 

I've posted an example piece of code that will do that. Can anyone reproduce the behavior? If you remove the 1ms timer, you'll be able to see the leak a lot faster. With the timer, you'll run out of memory overnight. You don't have to run the RT VI to see it, just running the Host VI2.vi will do.

 

Thanks.

0 Kudos
Message 1 of 14
(3,701 Views)

Sima,

 

By memory leak, do you just mean an increased usage in RAM? 

 

When I removed the wait timer, it just used about 50% of RAM, and stayed that way for some time before I stopped it. We always reccomend using a wait function for that exact purpose. We also reccomend using a wait function so all your loop iterations will be the same length of time.

 

I guess I just need some more information on wxactly what symptoms you are seeing, as I was not able to reproduce anything significant on my end.

Chris Van Horn
Applications Engineer
0 Kudos
Message 2 of 14
(3,667 Views)

Hi Chris,

 

Yes, I mean an abnormal increased usage in RAM. Even without the timer, this shouldn't occur. I'd expect the CPU usage to go up significantly and some memory usage, but not to the point where LV would end up using 2GB of memory. Anyway, even with the timer, I left the VI running overnight and came back to find an "out of memory" message.

 

When you said it used 50% of RAM, I don't think that's normal at all. What is your 50% in GB?

 

Thanks.

0 Kudos
Message 3 of 14
(3,648 Views)

Sima,

 

50% of my RAM is 1GB, which is 100% expected. When you have no wait, the computer runs the loop as fast as is allowed, which would be half of your RAM. So, while this is expected behavior, the out of memory message is not.

 

Just to clarify, this is a Window's error message or a LabVIEW? I assume its Window's, but I could be mistaken.

Chris Van Horn
Applications Engineer
0 Kudos
Message 4 of 14
(3,644 Views)

Sima,

I'm very sorry. I was confusing you talking about CPU usage and memory usage. Yes, the CPU usage will go to 50% with no wait, but the memory usage should not. 

 

I am replicating your error very slowly though with an increasing memroy usage. It seems that it is not a slow/consistent leak, but random packets that will slowly take up all your memory.

 

Is there a reason for you only having a 0-1 ms wait as opposed to a longer one? It seems like reading/writing at that rate COULD cause missing packets, especially on a PC, where any hiccup could cause a hangup in the program.

 

Again, sorry for the confusion, while typing this my memory usage for LV has gone from 219,299K to 219,444K

 

Chris Van Horn
Applications Engineer
0 Kudos
Message 5 of 14
(3,628 Views)

Hi Chris,

 

Thanks, that makes a lot more sense! 🙂 I set the timer to 1ms just to see if the memory would creep up faster. I removed the timer completely also just for testing. If you can, leave that VI running overnight and you may see it get pretty high. Originally I think I had my loop running at 100ms, and I found an out of memory message (which I think was LV) the next morning. LV had taken up all its 2GB.

 

Sima

0 Kudos
Message 6 of 14
(3,621 Views)

Sima,

 

I have just tried this on 2 different LV 8.6 machines, and neither has caused the memory leak. I am trying to look through our documentation to see if this was a fix from 8.5.1 to 8.6, but can not currently verify that.

Chris Van Horn
Applications Engineer
0 Kudos
Message 7 of 14
(3,613 Views)

 

I ran the leak VI all night and the memory increase was negligible, its low enough that I don't even know if I would classify it as such. This is on a machine running 8.6 instead of 8.5.1 though. 

Chris Van Horn
Applications Engineer
0 Kudos
Message 8 of 14
(3,600 Views)
Chris, I'm using LV 8.5.
0 Kudos
Message 9 of 14
(3,579 Views)

Sima,

 

Yes, I know you're not using 8.6.  I just wanted to show you that while my PC also leaked with your VI in 8.5, it did not in 8.6, which goes back to a few posts back when I thought that it was fixed with the new version.

Chris Van Horn
Applications Engineer
0 Kudos
Message 10 of 14
(3,563 Views)