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 57675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:43:42+00:00 2026-05-10T17:43:42+00:00

One of our programs is sometimes getting an OutOfMemory error on one user’s machine,

  • 0

One of our programs is sometimes getting an OutOfMemory error on one user’s machine, but of course not when I’m testing it. I just ran it with JProfiler (on a 10 day evaluation license because I’ve never used it before), and filtering on our code prefix, the biggest chunk both in total size and number of instances is 8000+ instances of a particular simple class.

I clicked the ‘Garbage Collect’ button on JProfiler, and most instances of other classes of ours went away, but not these particular ones. I ran the test again, still in the same instance, and it created 4000+ more instances of the class, but when I clicked ‘Garbage Collect’, those went away leaving the 8000+ original ones.

These instances do get stuck into various Collections at various stages. I assume that the fact that they’re not garbage collected must mean that something is holding onto a reference to one of the collections so that’s holding onto a reference to the objects.

Any suggestions how I can figure out what is holding onto the reference? I’m looking for suggestions of what to look for in the code, as well as ways to find this out in JProfiler if there are.

  • 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. 2026-05-10T17:43:43+00:00Added an answer on May 10, 2026 at 5:43 pm

    Dump the heap and inspect it.

    I’m sure there’s more than one way to do this, but here is a simple one. This description is for MS Windows, but similar steps can be taken on other operating systems.

    1. Install the JDK if you don’t already have it. It comes with a bunch of neat tools.
    2. Start the application.
    3. Open task manager and find the process id (PID) for java.exe (or whatever executable you are using). If the PID’s aren’t shown by default, use View > Select Columns… to add them.
    4. Dump the heap using jmap.
    5. Start the jhat server on the file you generated and open your browser to http://localhost:7000 (the default port is 7000). Now you can browse the type you’re interested in and information like the number of instances, what has references to them, etcetera.

    Here is an example:

    C:\dump>jmap -dump:format=b,file=heap.bin 3552  C:\dump>jhat heap.bin Reading from heap.bin... Dump file created Tue Sep 30 19:46:23 BST 2008 Snapshot read, resolving... Resolving 35484 objects... Chasing references, expect 7 dots....... Eliminating duplicate references....... Snapshot resolved. Started HTTP server on port 7000 Server is ready. 

    To interpret this, it is useful to understand some of the array type nomenclature Java uses – like knowing that class [Ljava.lang.Object; really means an object of type Object[].

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

Sidebar

Ask A Question

Stats

  • Questions 75k
  • Answers 75k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer If you are doing a breadth first search the natural… May 11, 2026 at 2:41 pm
  • added an answer Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given… May 11, 2026 at 2:41 pm
  • added an answer Use String#scan: >> 'abcdefghijklmnopqrstuvwxyz'.scan(/.{4}/) => ['abcd', 'efgh', 'ijkl', 'mnop', 'qrst',… May 11, 2026 at 2:40 pm

Related Questions

One of our programs is sometimes getting an OutOfMemory error on one user's machine,
I was looking around the internet and couldn't find a perfect algorithm for this
One of our programs is erroring out because a stored procedure was created with
Background: Some time ago, I built a system for recording and categorizing application crashes
We have some COBOL programs in our financial applications which need to interact with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.