Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 91986 invoked from network); 16 Nov 2003 00:31:48 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 16 Nov 2003 00:31:48 -0000 Received: (qmail 84639 invoked by uid 500); 16 Nov 2003 00:31:31 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 84476 invoked by uid 500); 16 Nov 2003 00:31:30 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 84463 invoked from network); 16 Nov 2003 00:31:30 -0000 Received: from unknown (HELO umbongo.flamefew.net) (64.253.103.114) by daedalus.apache.org with SMTP; 16 Nov 2003 00:31:30 -0000 Received: by umbongo.flamefew.net (Postfix on Linux (i386), from userid 500) id 005C013FA; Sat, 15 Nov 2003 19:31:29 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by umbongo.flamefew.net (Postfix on Linux (i386)) with ESMTP id EF9E013F9 for ; Sat, 15 Nov 2003 19:31:29 -0500 (EST) Date: Sat, 15 Nov 2003 19:31:29 -0500 (EST) From: Henri Yandell X-X-Sender: hen@umbongo.flamefew.net To: Jakarta Commons Developers List Subject: Re: Fileupload: fails for forms with a large number of inputs with OurOfMemoryError In-Reply-To: <3F85C9E9.8020305@google.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Were any of the fileupload committers interested in this patch? Can't see any obvious replies. Hen On Thu, 9 Oct 2003, Mike Samuel wrote: > The fileupload package is well-architected, and a pleasure to use, but I ran > into a problem. Attached is a test case servlet which repeats the problem with > the Jun 24, 2003 fileupload-1.0 release. > > FileUploadBase.parseRequest runs out of memory when parsing a form with a large > number of inputs. The cause seems to be DeferredFileOutputStream which > allocates a ByteArrayOutputStream per input, each of which preallocates a buffer > of length inMemoryThreshold. The in memory threshold defaults to 10k, but if it > is made larger (> 1 M in our environment), then the vm quickly runs out of > memory. Most of this memory is wasted since most files are ~5k, and almost all > non-file inputs are less than 1k. > > I patched DeferredFileOutputStream to use a different underlying in memory > stream. I don't really know why ByteArrayOutputStream uses a single byte[], > since you can't do random access on the underlying buffer anyway. > I think the patch is something that could be incorporated into the default file > upload implementation without any noticable change in performance. > > If anyone's interested in the patch, should I send it to someone, or check it in > myself? I've never contributed any code to apache before so I'm a little fuzzy > on process. > > thanks, > mike > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org