At 03:58 PM 3/19/99 +0100, Robb Shecter wrote:
>I've noticed weird behavior with JDK1.1.7a (Suse 6.0) that I didn't see
>with JDK 1.1.6: When doing the most basic system exec, and then reading
>in the stdin, Java frequently hiccups, for a good second or two, usually
>when garbage is collected.
117_v1a right? although I've not run 116, you should have seen it there
too... unless something else masked the behaviour. What I'm seeing in the
example you posted below is the standard penalty for a garbage collected
language, especially when you're creating as much garbage as you do in
this tight little loop:
> while ((line = in.readLine()) != null) {
> System.out.println(line);
running 117_v1a, native, with the -verbosegc option I see that a quick run
on my "toy" system produced 137598 objects and 8000423 bytes worth of trash!
Most of that is because of this loop, if I take it out then I only get
348 objects and 14432 bytes of trash. (of course I also lose the
functionality of the program ;) I would highly recommend that you
write your own readln method taking a char[] or a StringBuffer if you
_have_ to have an object and recycling a single object throughout the
operation. Just because gc is there doesn't mean we _have_ to use it ;)
>Here's a small class that demonstrates the problem by calling a command
>that generates a lot of output. It doesn't hiccup as much as my Find
>class does, but it still shows the effect:
I'm guessing that it doesn't hickup as much because it doesn't result
in as much output, right? I wasn't able to recreate anything longer
than 100ms on my machine (133 Pent, 80MB RAM) with this form, but I've
certainly seen GC's take upwards of a few minutes on machines at work
(don't ask.... ;)
<*> cabbey at rconnect dot com http://homepage.rconnect.com/cabbey/ <*>
"What can Microsoft do? They certainly can't program around us." - Linus
-----BEGIN GEEK CODE BLOCK----- Version:3.12 http://www.geekcode.com
GCS$/IT/PA$ d(-) s++:+ a-- C+++$ UL++++ UA++$ P++ L++ E- W++ N+ o? K? !P
w---(+)$ O- M-- V-- Y+ PGP+ t--- 5++ X+ R tv b+ DI+++ D G e++ h(+) r@ y?
------END GEEK CODE BLOCK------
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]