• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java out of memory during compile time

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need help to generate java Out of memory error during compile time.

Some thing like:
when I try to compile a java program with SUN JDK I should get an out of memory error.

One thing I have in mind now is importing more classes into my application as
import one;
import two;
.
.
.
import thousand;

Please hep me in this. Other than importing more classed; Is there any other way that forces the virtual machine into out of memory error during compile time ??
For information sake I am using jdk 1.5.0

Regards,
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have an answer. Can I ask why you want to do this?
 
Arjun K
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
we have developed an monitoring tool that do some thing on Out of memory situation. I just want to test whether its doing good on this situation.

I think you understood it.

Thanx in advance.
 
Horatio Westock
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK. Roughly, how does your monitor work?
 
Arjun K
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont think I can explain in couple of words or sentences. Its moreover a project all toghter.

Moreover we used javax.management and java.management api's in implementing
this.

Will this helps you understand.

I repeat my requirement; which is to write an app which generates an out of memory during compile time. Does it related to any of the implementation and design of the project?

Let me know.

Thanx in advance.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

First, a bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. "Handles" aren't acceptable, and a single name is not enough (although we would make an exception for Christo if he wanted to learn about Java.) You can change your display name
here.
Thanks!

Second, note that you can pass Java options to javac using the -J switch. So one way to force an OutOfMemoryError would simply be to give javac only a small heap to work with. I just tried it, and I can force an OutOfMemoryError while compiling a single trivial class by using

javac -J-Xms2m -J-Xmx2m Foo.java

The "-J-Xms2m -J-Xmx2m" limits the JVM running javac to 2 megs of Java heap -- the compiler can't get very far with that.
 
Arjun K
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friedman-Hill,

I have changed my name according to the javaranch naming policy.

Coming to the solution that you proposed is more of giving java options with the javac command line. But my question is different; its rather an intentional generation of outofmemory during the compile time.

Hope you understood,

Thanx in advance.
 
Arjun K
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friedman-Hill,

I was in a soup and missed some where. Sorry for incompleted previous reply.

It worked perfectly fine with your option.

Thanx for your reply,
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
He he ... probably this is why it is said not to speak with the mouth full .

--
:alex |.::the_mindstorm::.
 
Ranch Hand
Posts: 171
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try running javac from Ant with <javac fork="true" memoryMaximumSize="1m">

This will give javac a very small amount of memory to run in. It should be easy to get it to run out of memory.

Note: I have not tested this.

See http://ant.apache.org/manual/ for instruction on using Ant.

Geoffrey
 
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic