The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


look ! What's wrong with java in memory ?

Posted by harold bondz on August 17, 2001 at 2:12 PM

try the following program, it will throw
a out of memory exception when it get about
no more than 10M memory. ( it require 32 M )
what's wrong with java!!!

class MType {
int dummy;
public class MemTest {
public static void main(String[] args) {
int maxmsg = 8000000;
MType[] msg = new MType[maxmsg];
for(int i= 0; i< maxmsg; i++) {
if( i % 1000 == 0)
msg[i] = new MType();



Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us