LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Check out our General Code Repository Files. Also, before posting here, check to see if your post doesn't fit into another subforum by category.


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> Mem usage in task manager expands unlimited!
nistam
post Feb 17 2005, 01:33 PM
Post #1


Active
*

Member
Posts: 21
Joined: 5-July 04
From: Athens, Greece
Member No.: 505
LV:7.1


The last few days i created an application that reads data from both serial ports and forwards them to a OPC server. Today i noticed that my application had crashed and Windows had displayed a message that my system was low on virtual memory. I reset the system and i re-run the application, having the task manager opened. I noticed that the memory usage of my exe was taking more and more memory (starting from 21.520KB) as the seconds went by. In 5 minutes my app was using 25Mbytes! What i do in my application exactly, is opening the 2 serial ports then i enter the main while-loop, then every 2 seconds i read from the 2 serials and if i have new data i open a connection to my OPC server (a WinCC scada) and write them to 2 different tags, and finally i close the connection with the OPC. I read two I8 values and i write them to two I8 tags. I must say that i have not used error trapping extensively. Does anybody have come through some such problems with extensive memory usage from one small EXE made with Labview? Could it be possible that my minimal error trapping can cause such problems???


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Feb 17 2005, 01:33 PM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
Louis Manfredi
post Feb 17 2005, 01:46 PM
Post #2


Extremely Active
****

Premium Member
Posts: 265
Joined: 1-December 04
Member No.: 1144
Using LabVIEW Since:1992
LV:8.5 ,7.1.1 ,.
United States Italy Canada


I don't see why minimal error trapping should cause the error-- though error trapping might find the error or make it easier for you to find it.

I wonder whether you are creating a new handle, or reference to some resource (the serial port, the OPC server, or something else) each time inside your loop, and failing to destroy that reference when you are done with it. That sort of error can cause a program to gradually soak up all available memory. If so, if you can, better to create only one reference, and use it over and over. Second choice would be to create an new reference every time, but be sure to close the reference when done with it.

Hope this helps, in any case, good luck!


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
nistam
post Feb 18 2005, 07:23 AM
Post #3


Active
*

Member
Posts: 21
Joined: 5-July 04
From: Athens, Greece
Member No.: 505
LV:7.1


QUOTE (Louis Manfredi @ Feb 17 2005, 08:46 AM)
I don't see why minimal error trapping should cause the error--  though error trapping might find the error or make it easier for you to find it.

I wonder whether you are creating a new handle, or reference to some resource (the serial port, the OPC server, or something else) each time inside your loop, and failing to destroy that reference when you are done with it.  That sort of error can cause a program to gradually soak up all available memory.  If so, if you can, better to create only one reference, and use it over and over.  Second choice would be to create an new reference every time, but be sure to close the reference when done with it.

Hope this helps, in any case, good luck!
*



I open two refferences to both serial ports outside the main loop. I use tunnels when the loop starts. I destroy these refferences after the loop stops. Inside the loop, i open one (or two, it depends on the settings' file) connection to my OPC, ONLY when i have new or changed data. After that i immediately close these refferences. So, nothing remains undestroyed. I'm only thinking of those tunnels for the serial refferences. Maybe i should use shift registers.


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Louis Manfredi
post Feb 18 2005, 03:47 PM
Post #4


Extremely Active
****

Premium Member
Posts: 265
Joined: 1-December 04
Member No.: 1144
Using LabVIEW Since:1992
LV:8.5 ,7.1.1 ,.
United States Italy Canada


Hi Nistam:

I agree that you should be O.K. -- assuming that LabView does what it should do in terms of releasing all the memory used by the OPC reference when you close it.

As far as I know, no reason why you should have to use a shift register for the reference to the serial resources-- obviously things can change on the port itself, but as far as I know the reference to it remains unchanged over its lifetime, so there's no need to make it a shift register. Anyone else disagree?

Make sure you haven't inadvertently enabled auto-indexing for the serial port reference (or any thing else) as it tunnels into or out of the loop. (I once had a nasty problem related to an unintended auto-index-- Its amazing how much aggravation a worn out mouse that transmits unintended double-clicks can do. oops.gif )

At any rate, good luck on the problem.


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
proximableu
post Mar 7 2005, 08:44 AM
Post #5


More Active
**

Member
Posts: 34
Joined: 4-October 04
From: Stockholm
Member No.: 744
Using LabVIEW Since:2000
LV:8.5 ,8.2.1 ,7.0
Sweden Ukraine Israel


Hi!
Maybe this is something with VISA, I think. I have such problem in my application, that must run for a 24 hour without stopping. Serial traffic very extensive, and i used a "daemon" to pick up data from serial port.
I open one reference to port and just only once, flushing buffer do not helps much, there is no difference between sync. and async. Closing daemon, than starting it again , trying to force deallocation, does not help. When I close application (destroying threads - destroying child process) than memory been released.
Maybe it is Win2K issue?

/ProximaBleu

This post has been edited by proximableu: Mar 7 2005, 08:46 AM

--------------------
Some bugs are very small, but VE-E-ERY STINKY..


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
FLX
post Mar 7 2005, 04:19 PM
Post #6


Very Active
***

Member
Posts: 64
Joined: 16-September 04
From: munich (erding)
Member No.: 688
Using LabVIEW Since:2000
LV:7.1 ,8.0 ,7.0
ger_bavaria Nothing Selected Nothing Selected


Hi

if it possible for you application leave the OPC-connection open, like the references of the serial communication. Have a look at other references. Sometimes memory is not released, even you close it.
You can use the memory monitoring vi, to figure out which vi is creating the memory leak.
You find it under examples->memmon.llb

Ciao

Alex

This post has been edited by FLX: Mar 7 2005, 04:23 PM


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
i2dx
post Mar 12 2005, 08:23 AM
Post #7


(n0ob)²
****

Member
Posts: 756
Joined: 22-October 04
From: Duesseldorf / Germany
Member No.: 885
Using LabVIEW Since:2001
LV:8.20 ,7.1.1 ,.
ger_bavaria Germany ger_rhineland


QUOTE (FLX @ Mar 7 2005, 05:19 PM)
Hi

if it possible for you application leave the OPC-connection open, like the references of the serial communication. Have a look at other references. Sometimes memory is not released, even you close it.
You can use the memory monitoring vi, to figure out which vi is creating the memory leak.
You find it under examples->memmon.llb

Ciao

Alex
*



in july 2004 i experienced a bug in the LabVIEW DataSocket Vis, which showed the same behavior (creating a memory leak) as you described. Furthermore my Programm was crashing when opening more then 7 Items on the OPC-Server simultaneously. I think the new DataSocket VIs in LabVIEW 7 / 7.1 are not as well programmed as they should be. The only chance to get rid of this was:
remove all the DS-Vis and attach DS-Connections to Controls which i used as "local Variables", which worked.

This was a very very ugly programming style and i hated this solution, but it was the only way to get the software running "properly". I don't know if NI has fixed this issues in the 7.1.1 Update.

best regards
cb

--------------------
don't take me to serious
my Website my ADO-Toolkit for LabVIEW™


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 1st December 2008 - 07:00 PM