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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:13:10+00:00 2026-06-19T00:13:10+00:00

My application needs about 10 GByte of RAM for specific input, where for regular

  • 0

My application needs about 10 GByte of RAM for specific input, where for regular inputs roughly 1 GByte is enough. Closer analysis with JProfiler reveals that (after GC) quite a lot of memory is used by standard classes from java.util.*:

LinkedHashMap$Entry, HashMap$Entry[], LinkedHashMap, HashMap$KeySet, HashMap$EntrySet, LinkedHashSet, TreeMap$Entry, and TreeMap (in this order), and related classes. The following entry is of a class in my own code, where the number of instances and the amount of used memory seems very reasonable.

In detail with a total heap usage of about 900 MByte I see the following Size entries in the All Objects view:

  • LinkedHashMap$Entry: 418 MByte
  • HashMap$Entry[]: 178 MByte
  • LinkedHashMap: 124 MByte
  • HashMap$KeySet: 15 MByte

The memory used by LinkedHashMap seems to be too high, even when considering that every LinkedHashSet is backed by a LinkedHashMap.

I recorded object allocation in JProfiler and observe the Allocation Hot Spots for LinkedHashMap. In there, I see entries that I do not understand:

  • The third entry shows a hot spot (with 6.5% of the allocated memory) named X.<init> where X is a class in my own code. The constructors of this method do not have anything to do with LinkedHashMap. Following this entry to Thread.run at the end shows a slow decline from 6.5% to 5.8% at Thread.run. What could be the problem with my code in X? Why is it shown here?
  • About 8% of allocated memory is shown in the hot spot named java.util.HashSet.iterator. Following this entry along the path with the highest percentage (first entry: 2.8%) I get several methods inside my code until, finally, java.lang.Thread.run is shown (with 2.8%). What does this mean? As far as I know the Thread.run method does not create instances of LinkedHashMap. What is the connection to the iterator method?

In general, how do I find the code that keeps references to (a lot of) LinkedHashMap objects? Using the Heap Walker I can only see lots of those instances, but do not see any pattern (even when observing the paths to the GC roots). In my experiments all instances seem to be in order.

Possibly important things:

  • My application constructs a result (for further processing) and, for this construction, the high memory usage is observed. The construction continually creates objects, so waiting for a stable point and then observing every single created LinkedHashMap object is not possible.
  • I have good computers available to debug (up to 48 cores and 192 GByte of RAM, possibly even more).
  • java version “1.7.0_13” (Java(TM) SE Runtime Environment (build 1.7.0_13-b20),
    Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode))
  • JProfiler 7.2.2 (Build 7157), licensed
  • 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-19T00:13:12+00:00Added an answer on June 19, 2026 at 12:13 am

    In general, how do I find the code that keeps references to (a lot of) LinkedHashMap objects?

    In the heap walker, select “LinkedHashMap” and create a new object set. Then switch to the “References” view and show the “Cumulated incoming references”. There, you can analyze references for the entire object set.

    enter image description here

    As for your question about the allocation hot spots and why the Thread.run method is shown: These are back traces, they show how the hot spot has been invoked and all numbers on the nodes are contributions to the hot spot at the top. The deepest node will already always be an entry point, typically a Thread.run method or the main method.

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

Sidebar

Related Questions

My application server needs to notify users about some events via email. Usually there
I have an application that needs to render about 100 flash graphs (as well
My application needs to log informations about user actions (inserts, updates, deletes, etc) and
My application needs to display a table of customer data, including data about the
I am designing an application that needs to update a server at regular intervals,
My application needs to communicate with a embedded device which is about 1MHz clock
I am writing a C# application that needs to read about 130,000 (String, Int32)
I need to detect information about the Application Server my EJBs are running in.
My application needs to send video data frame by frame from Server to Client.
my application needs multiple jars to work. Since it is a desktop application i

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.