Hmmmmm. got me.  It seems like that 'should' work.  I'm caught up in something
else at the moment, but will try and dupilcate it here a little later and see if
I can figure out why it would behave that way.  Does it work when you use
doc.output(res.getOutputStream())? without writing it to an intermidary
bytearrayoutputstream object?

-stephan





Huw Richards <[EMAIL PROTECTED]> on 09/25/2000 11:41:56 AM

Please respond to "ECS" <[EMAIL PROTECTED]>

To:   "'ECS'" <[EMAIL PROTECTED]>
cc:    (bcc: Stephan Nagy/TheSphereHQ)

Subject:  RE: Memory problems



Hi

After reading the message below about using ecsobject.output(out), I tried
converting a few of our servlets to this manner -- we are currently using
out.println(ecsobject.toString())

A snippet of my code is as follows:

ByteArrayOutputStream bytes = new ByteArrayOutputStream(1024);
PrintWriter out = new PrintWriter(bytes,true);
Document doc = (Document)format.getFormattedData();  // this is an ECS page
doc.output(out);
res.setContentLength(bytes.size());
bytes.writeTo(res.getOutputStream());

This results in a blank page in IE.

If I don't bother using the ByteArrayOutputStream for persistent connections

then the page is sent correctly, i.e.:

PrintWriter out = res.getWriter();
Document doc = (Document)format.getFormattedData();
doc.output(out);

Anyone tell me why the latter works, whilst the former does not?


--
Huw Richards
[EMAIL PROTECTED]



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 25 September 2000 06:49
To: ECS
Subject: Re: Memory poblems



_________________________________________________

              *** WARNING ***

This message has been received from the Internet.
Please save any attachments before opening them.

_________________________________________________





simplest solution don't use out.println(ecsobject.toString()); do this
instead.

ecsobject.output(out);

toString() is a VERY expensive operation and will increases you memory usage
by
at least 2x.  I'm generating large ecs data structures ( 8 meg files ) and
using
output(out); and it works just fine.

-stephan




--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]


___________________________________________

Confidentiality Note

This message may contain privileged and confidential information.
If you think, for any reason, that this message may have been
addressed to you in error, you must not disseminate, copy or
take any action in reliance on it, and we would ask you to notify
us immediately by return email to "[EMAIL PROTECTED]".




--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]









--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to