Re: Java app takes 100% of CPU
From: Mark Murphy (n-murphy_at_charter.net)
Date: 12/01/04
- Next message: Hari Prasad: "Converting byte array to string"
- Previous message: Mark Murphy: "Re: Need a Java project"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Nov 2004 22:13:04 -0800
Randolf Richardson wrote:
> "Roman Levandovsky <roman@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.
- Next message: Hari Prasad: "Converting byte array to string"
- Previous message: Mark Murphy: "Re: Need a Java project"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|