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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:43:42+00:00 2026-06-09T10:43:42+00:00

I create a custom table, not extends from JTable, and i have a huge

  • 0

I create a custom table, not extends from JTable, and i have a huge amount of data approx 4.000.000 string data (10% uniq string). Now i create and index which looks like this:

I create and index for every column. I use treeset for merging data when the user use live search functionality of my table.

Index:

ArrayList which represent the columns:
Column 1 | Column 2 | Column 3 | Column 4
Each element the arraylist contains a HasMap which represent the index:
key -> the data String
value -> the value represent which rows contains this index inside a TreeSet

Example:

Name Column:
Emma 
John
Doe
Emma
Walker
Emma
Doe

HashMap(Emma) -> 0, 3, 5
private void buildIndex()
    {
        if (monitorModel.getMessageIndex() == null)
        {
            ArrayList<HashMap<String, TreeSet<Integer>>> messageIndex = new ArrayList<>(filterableColumn.length);
            for (int i = filterableColumn.length; i >= 0; i--)
            {
                HashMap<String, TreeSet<Integer>> hash = new HashMap<>();
                messageIndex.add(hash);
            }
            // create index for every column
            for (int i = monitorModel.getParser().getMyMessages().getMessages().size() - 1; i >= 0; --i)
            {
                TreeSet<Integer> tempList;

                for (int j = 0; j < filterableColumn.length; j++)
                {
                    String value  = StringPool.getString(getValueAt(i, j).toString());
                    if (!messageIndex.get(j).containsKey(value))
                    {
                        tempList = new TreeSet<>();
                        messageIndex.get(j).put(value, tempList);
                    }
                    else
                    {
                        tempList = messageIndex.get(j).get(value);
                    }

                    tempList.add(i);
                }
            }
            monitorModel.setMessageIndex(messageIndex);
        }
    }

This solution use 500MB heap size which is impossible, how i can optimize this code?

  • 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-09T10:43:43+00:00Added an answer on June 9, 2026 at 10:43 am

    500MB heap size which is impossible

    I seriously doubt it uses only that much if you have 4 billion strings. I suspect you application stops at that point.

    If you have “4.000.000.000 string data” then this will use about 100 bytes per string to store in a collection (assuming the strings are short)

    This means you need 400 GB of memory. The only way to make this more efficient and workable is to use memory mapped files. You can fairly easily hold this much data this way.

    On the other hand if you meant 4 million, not 4 billion then a size of 500 MB is quite reasonable. Given 500 MB costs about $10 these days, I wouldn’t worry about it.

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

Sidebar

Related Questions

I have a custom table created which has a foreign constraint on the core_website
I have created a custom cell for loading into a table. The interface is
I have a custom mysql table we'll call module_identifiers and a corresponding model in
Is it correct, that in Web2Py you are not able to create custom methods
I'm trying to create a custom table view cell that has a button on
I have a mySQL table with a reference set of data in it. I
I'm using a UITableView to display custom cells created with Interface Builder. The table
We're writing an application for Windows tablet PCs. I have created a custom control
I am attempting to create custom colors of the tabs in a TabHost. I
How to create Custom shaped buttons in c#: say triangular

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.