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

  • Home
  • SEARCH
  • 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 670477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:16:02+00:00 2026-05-14T00:16:02+00:00

I have a server application that, in rare occasions, can allocate large chunks of

  • 0

I have a server application that, in rare occasions, can allocate large chunks of memory.

It’s not a memory leak, as these chunks can be claimed back by the garbage collector by executing a full garbage collection. Normal garbage collection frees amounts of memory that are too small: it is not adequate in this context.

The garbage collector executes these full GCs when it deems appropriate, namely when the memory footprint of the application nears the allotted maximum specified with -Xmx.

That would be ok, if it wasn’t for the fact that these problematic memory allocations come in bursts, and can cause OutOfMemoryErrors due to the fact that the jvm is not able to perform a GC quickly enough to free the required memory. If I manually call System.gc() beforehand, I can prevent this situation.

Anyway, I’d prefer not having to monitor my jvm’s memory allocation myself (or insert memory management into my application’s logic); it would be nice if there was a way to run the virtual machine with a memory threshold, over which full GCs would be executed automatically, in order to release very early the memory I’m going to need.

Long story short: I need a way (a command line option?) to configure the jvm in order to release early a good amount of memory (i.e. perform a full GC) when memory occupation reaches a certain threshold, I don’t care if this slows my application down every once in a while.

All I’ve found till now are ways to modify the size of the generations, but that’s not what I need (at least not directly).

I’d appreciate your suggestions,

Silvio

P.S. I’m working on a way to avoid large allocations, but it could require a long time and meanwhile my app needs a little stability

UPDATE: analyzing the app with jvisualvm, I can see that the problem is in the old generation

  • 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-05-14T00:16:02+00:00Added an answer on May 14, 2026 at 12:16 am

    From here (this is a 1.4.2 page, but the same option should exist in all Sun JVMs):

    assuming you’re using the CMS garbage collector (which I believe the server turns on by default), the option you want is

    -XX:CMSInitiatingOccupancyFraction=<percent>
    

    where % is the % of memory in use that will trigger a full GC.

    Insert standard disclaimers here that messing with GC parameters can give you severe performance problems, varies wildly by machine, etc.

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

Sidebar

Related Questions

I have a server application that receives information over a network and processes it.
I have a server application that uses a lot of threads. Without wanting to
I have a client/server application that communicates with .Net remoting. I need my clients
i have a server - client application that runs on java 1.3; i want
We have a Linux server application that is comprised of a number of open-source
I have a client server application that sends XML over TCP/IP from client to
I have a client-server application that uses .net remoting. The clients are in a
I have a client server based windows forms application that needs an administrator only
We have an application that installs SQL Server Express from the command line and
We have an application that runs over load balanced server instances, and therefore is

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.