commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davis Ford <>
Subject commons-fileupload DiskFileItemFactory / FileCleanerCleanup & memory
Date Fri, 16 Oct 2009 04:06:24 GMT
Hi, quick question on fileupload...

I have a gooogle web toolkit app that presents a UI to do the following:

1) Upload a file
2) Show a thumbnail of the upload after file has been uploaded
3) Repeat 1) and 2) if desired
4) Press Save -> Server takes files and puts them in final resting place

I can't afford to keep the files in memory for obvious reasons, so I need to
spill them to disk.  This is where the DiskFileItemFactory and the
FileCleanerCleanup become very useful.

My question revolves around memory usage, and ensuring I avoid
OutOfMemoryError.  After the #parseRequest( ) completes, I get the whole
byte array from the FileItem so I can create a thumbnail of it.

If I store the FileItem in the HttpSession after reading the byte array,
does it keep the byte array resident in memory, or is it just read from disk
and returned (i.e. GC'd after the servlet thread expires) ?


Zeno Consulting, Inc.
p: 248.894.4922
f: 313.884.2977

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message