?
Solved

Increasing Allocated Memory

Posted on 2004-09-09
3
Medium Priority
?
256 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

649 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