03-20-2009 03:19 AM
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
Solved! Go to Solution.
03-20-2009 04:47 AM
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
03-20-2009 05:00 AM
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?
03-20-2009 05:13 AM
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
03-20-2009 06:22 AM
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?
03-20-2009 07:19 AM
"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
03-20-2009 08:00 AM
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
03-25-2009 08:26 AM
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