LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The CPU usage increases, over a few hours until the application crashes

Solved!
Go to solution

I have written an application to control ship antennas. I have met all the customer requirements. However, when I run my application the CPU usage starts at around 13% (mode dependant) and creeps 5% approx every 30mins, until finally the usage reaches 100% and unsurprisingly the application becomes unresponsive.

 

My application communicates with the antenna via serial connection. I have an interface for a remote connection via LAN that uses TCP and I broadcast UDP packets onto the LAN for use by other ship systems (shares data such as ships heading etc). The 3rd party that have written the remote application have utilised my UDP broadcast as a means to recieve data from my application.

 

My application has several vi's. Should I zip these and attach?

 

Any help or pointer as to why the usage creeps would be most welcome. My initial feeling is that a buffer is overflowing, but where and which? I do use notifiers to communicate between loops and have a few global variables that communicate my menu selection.

 

Thanks

 

Steve 

0 Kudos
Message 1 of 8
(4,904 Views)

Steve,

 

some questions:


Steve S wrote:

However, when I run my application the CPU usage starts at around 13% (mode dependant) and creeps 5% approx every 30mins, until finally the usage reaches 100% and unsurprisingly the application becomes unresponsive.

[...]


What is the process with increasing CPU load? Is it your application?

 


Steve S wrote:

[...]My initial feeling is that a buffer is overflowing, but where and which? [...]


 

An overflowing buffer is in my opinion not responsible for increased CPU load. If a buffer runs over, there are two common events: a crash due to an error (in application layer like:integrity of data space violated or on system level which is most often an unhandled exception or more often access violations). In order to get a feeling about this, please observe the memory usage as well.

If i were you, i would double check for used references and observe the timing within the application. My feeling tells me that you have structures which try to keep up a certain timing but in order to do this, they have to speed up over time....(which can be created by e.g. growing data structures)....

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(4,891 Views)

It is definately my application.

 

I have noticed that I have obtained notifiers that contain clusters within a loop and haven't released them. So the notifier is created each iteration and not released, could this cause the problem?

 

 

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

Depends on how you programmed it. But in either case that does not point to CPU load issues in the first place. Please do an observation of the memory. Does it grow as well? How fast? Does the PC mainly access the harddrive in the end?

We have to find out if the CPU load is the result of increasedc memory usage or if it is "stand alone".... 

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 8
(4,882 Views)

I have monitored the memory usage and it is flat. I have also noticed that the increase in cpu usage is in 4-5% steps approx every 30 mins.

 

When you say data growth, what exactly do you mean and what are the normal causes?

0 Kudos
Message 5 of 8
(4,872 Views)

"Normal causes" for growing data are array- and stringhandling and referenced objects. If the growth is not limited, it will cause the system to encounter "out of memory".

 

You say that the CPU load steps up every 30 min. So it is not a continuous process. Do you have some components in your application, which are called once every 30 minutes?

Maybe now it is time to zip the application sources and post them 🙂

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 8
(4,864 Views)
Solution
Accepted by topic author Steve_S1

Steve S wrote:

It is definately my application.

 

I have noticed that I have obtained notifiers that contain clusters within a loop and haven't released them. So the notifier is created each iteration and not released, could this cause the problem?

 

 


YUP!

 

Resources should be allocated (notifier created) before loops and then a ref to them use din the loop. Only after the loop completes should it be closed.

 

Post your code if you want us to look closer.

 

Ben

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

Thanks guys. I found the problem.

 

I had obtained notifiers within a while loop without closing them.

 

All works ok now.

 

Thanks for the help

0 Kudos
Message 8 of 8
(4,814 Views)