I've included code in my servlets to compress the output of HTML using GZIPOutputStream
(you may have seen this technique on page 106 of Core Servlets and JavaServerPages
by Marty Hall).

Since doing so, the load time on the pages has decreased, by I'm getting
way more OutOfMemoryErrors on the server (JavaWebServer2.0 running on my
766 MHz desktop with 512MB Ram).

Is there a way to compensate for this? Does anyone know why using GZIP is
causing such a memory drain? Is there a buffer I should be flushing, or
some setting I can increase?