Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8385945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:47:37+00:00 2026-06-09T17:47:37+00:00

I checked with following code in my servlet: int mb = 1024 * 1024;

  • 0

I checked with following code in my servlet:

int mb = 1024 * 1024;
Runtime runtime = Runtime.getRuntime();
out.write("Used Memory:" + (runtime.totalMemory() - runtime.freeMemory()) / mb);
out.write("Free Memory:" + runtime.freeMemory() / mb);
out.write("Total Memory:" + runtime.totalMemory() / mb);
out.write("Max Memory:" + runtime.maxMemory() / mb);

the output is :

Used Memory:10
Free Memory:46
Total Memory:57
Max Memory:57

I want my app not to use more than 64 MB heap? I want to know – is there any way my app can use more then 64 MB heap…(Max Memory:57) ? ..will my app throw an OutOfMemoryException after 57MB?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:47:39+00:00Added an answer on June 9, 2026 at 5:47 pm

    Default Max Heap size is 64Mo, the only way to get more is to set the max size with this parameter :

    -Xmx256m
    

    While this parameter set the start value :

    -Xms128m
    

    Don’t forget the “m” at the end which means Megabytes, don’t give more start memory than max neither.
    Furthermore, there is no setMaxHeapSize() function if it’s what you are looking for.

    If you are runnning your servlet inside a tomcat you should try with this :

    export CATALINA_OPTS=-Xms16m -Xmx256m;
    

    in startup.bat

    If your servlet need more than JVM can allow, you will get weird errors when reaching the limit and most of the time a OutOfMemoryException, the Garbage Collector will try to avoid that though so it will crawl a bit before throwing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code (I checked objCur is not Nil before free}: try objCur.Free;
I have the following code: function toggleChecked(status) { $(.checkbox).each( function() { $(this).attr(checked,status); }) }
My program contains the following code. pthread_t PThreadTable[32]; for (i=1; i<P; i++) // Checked
Please have a look at the following code: $(#saveButton).click(function(){ $this = $(#tableData).find(input:checked).parent().parent(); tea =
So I have the following JavaScript code: <script type=text/javascript> function clearRadioButtons() { document.getElementById(radiobutton1).checked=; //etc
I have used following code to add three variables but instead of adding these
The following code demonstrates a case where a checked exception, ExecutionException , is thrown
I am working with the following code: If chkApproximately.Checked Then '.Item_Title = ~ &
I have the following code which enables a button when the checkbox is checked.
What does the @ sign in the following code means ? $(input[@type=checkbox][@checked]).each( function() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.