By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,220 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,220 IT Pros & Developers. It's quick & easy.

Java app takes 100% of CPU

P: n/a
We've been provided a Java app to use for a homework assignment on
databases. It's my own fault for writing inefficient queries, but it keeps
taking 100% of my CPU and it takes several minutes to get the Task Manager
open and kill it.

Is there a way, maybe with command line argument, to restrict the amount of
resources it can consume?

Thanks,
--
Wendy S
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Does it actually work?

"Wendy S" <we******@hotmail.com> wrote in message
news:kScjd.94065$cJ3.14822@fed1read06...
We've been provided a Java app to use for a homework assignment on
databases. It's my own fault for writing inefficient queries, but it keeps taking 100% of my CPU and it takes several minutes to get the Task Manager
open and kill it.

Is there a way, maybe with command line argument, to restrict the amount of resources it can consume?

Thanks,
--
Wendy S

Jul 17 '05 #2

P: n/a
Wendy S wrote:
We've been provided a Java app to use for a homework assignment on
databases. It's my own fault for writing inefficient queries, but it keeps
taking 100% of my CPU and it takes several minutes to get the Task Manager
open and kill it.

Is there a way, maybe with command line argument, to restrict the amount of
resources it can consume?

Thanks,

If it takes 100% of the CPU that means it is wasting resources either
because of a memory leak or because of too many threads or because of
excessive polling. Did you actually write the application?

Roman.
Jul 17 '05 #3

P: n/a
"Roman Levandovsky <ro***@none.com>" wrote in comp.lang.java:
Wendy S wrote:
We've been provided a Java app to use for a homework assignment on
databases. It's my own fault for writing inefficient queries, but it
keeps taking 100% of my CPU and it takes several minutes to get the
Task Manager open and kill it.

Is there a way, maybe with command line argument, to restrict the
amount of resources it can consume?


If it takes 100% of the CPU that means it is wasting resources either
because of a memory leak or because of too many threads or because of
excessive polling. Did you actually write the application?


I agree with all of those possibilities except the "memory leak." A
memory leak typically consumes memory rather than CPU cycles. If your system
gets stuck at 100% CPU utilization due to a memory leak, then there's likely
something else wrong with your system that needs a closer look.

--
Randolf Richardson, pro-active spam fighter - rr@8x.ca
Vancouver, British Columbia, Canada

Sending eMail to other SMTP servers is a privilege.
Jul 17 '05 #4

P: n/a
Randolf Richardson wrote:
"Roman Levandovsky <ro***@none.com>" wrote in comp.lang.java:

Wendy S wrote:

We've been provided a Java app to use for a homework assignment on
databases. It's my own fault for writing inefficient queries, but it
keeps taking 100% of my CPU and it takes several minutes to get the
Task Manager open and kill it.

Is there a way, maybe with command line argument, to restrict the
amount of resources it can consume?


If it takes 100% of the CPU that means it is wasting resources either
because of a memory leak or because of too many threads or because of
excessive polling. Did you actually write the application?

I agree with all of those possibilities except the "memory leak." A
memory leak typically consumes memory rather than CPU cycles. If your system
gets stuck at 100% CPU utilization due to a memory leak, then there's likely
something else wrong with your system that needs a closer look.

Might be time to learn what a profiler does. I had the same problem with
some code and discovered that it was one routine. Fixed that and
everything works alot better.

Personally I think a profiler can help teach students better
programming. Every project should be profiled and the student should
comment on the results.

Learn a profiler before you learn an IDE.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.