Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

WAS 4.0.7 Strange OutofMemoryError

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(This is a cross post from, but I'm too desperate to behave like a real man - if I find a solution I promise to post to both forums).

I see a real big problem with WebSphere Application Server, Release 4.0.7.
When I try to allocate a byte array I often run into OutofMemoryErrors though Runtime.getRuntime().freeMemory() reports enough free memory.

E.g. running with -Xmx128M and -Xms128M and allocation a byte array of 16M fails!
Here's the scriptlet of a test JSP page that allocates 2MB chunks and that fails:

And here is what it prints:
freeMem is 99874640
freeMem i= 0 99874640
freeMem i= 1 97874032
freeMem i= 2 118295984
... (3 to 11 left out) ...
freeMem i= 12 98277064
freeMem i= 13 96277048
freeMem i= 14 94277032
freeMem i= 15 92354160
Error: : java.lang.OutOfMemoryError

The VM reports to have ~88 MB free and it can't allocate another 1.9MB!
(The JSP is of course not useful at all, but first I found this error in a servlet that uses a ByteArrayOutputStream).
Both the JSP page and the servlet run fine on weblogic. The servlet is part of a large enterprise application that runs on WAS 4 (and that can't be changed).
When running a standalone test on the JBM VM the results are much more sensible. The OutofMemoryException will be thrown when the freeMemory is very low. Thus the test fails only in the servlet container.

Here is the exact data:
WebSphere AEs 4.0.7 ptf70339.05 running with process name STORCH/Default Server and process id 2252
Host Operating System is Windows 2000, version 5.0
Java version = J2RE 1.3.1 IBM Windows 32 build cn131w-20030711a ORB130 (JIT enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM

Can anyone help me?

And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic