Solved

Increasing Allocated Memory

Posted on 2004-09-09
3
244 Views
Last Modified: 2006-11-17

 sciuriware,

from http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21121871.html#12015860

I am also in need of that code. I have tested ur code. But I do not understand how to include with in classes.

1. When I execute this I use Java.exe as Runtime JVM whereas ur application takes javaw as runtime JVM. May I know the reason for this
2. When I tested this I am not getting anythig printed on screen. Is my perception of understanding that code is wrong??
Please clarify me

Thanks
Sudhakar



             public static void main(String[] argv) throws Throwable
          {
             
                new NeedMemory().needMemory(400, argv); // 400Mb limit, 200Mb initial.
                    System.err.println("Hello There");
                    StringBuffer sb=new StringBuffer("Hello World ");
                    try
                 {
                    while(true)
                 {
                         sb.append(sb.toString());
                                          System.err.println(sb.length());
                 }
                 }
                 catch(Throwable e)
                 {
                      System.err.println(sb.length());
                 }
                 System.err.println(sb.length());
            }

Sudhakar Chavli
0
Comment
Question by:sudhakar_koundinya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
sciuriware earned 50 total points
ID: 12018820
I must admit that the javaw thing is a MSWindows java that avoids an MSDOS box.

Do you realise that the above code explodes like a bomb?

Feel free to change the code I posted.
It works for me and for the original questioner.
If you understand it, you can change it to your needs.


I'm going home now. See you.

;JOOP!
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 12019074
>>Do you realise that the above code explodes like a bomb?

That is what I am facing. Some times it  takes entire RAM. Why So??
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12023882
Because it never stops doubling a String; even some ExaBytes of memory (a lot) are not enough!

;JOOP!
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question