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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:02:43+00:00 2026-06-05T18:02:43+00:00

I have a problem when try to use hashtable with large data. I have

  • 0

I have a problem when try to use hashtable with large data. I have a text file that contains over 111000 record, and when it reach 75000, outofmemory exception was thrown, so does anyone have any solution for this?

The problem happen at the line :

while ((text = reader.readLine())!= null);

and because of the java.lang.String <init> inside the readLine(), but I think the problem come from the hashtable too big to keep store data.
I tested it on my xperia Neo and it failed although it run quite good on another samsung device.

The object SoundUnit which I keep on hashtable has a structure below:

private String filename; 
private int start; 
private int end;

just above 3 field inside SoundUnit object.

Here is the piece of code I use to read data from text to store on hashtable:

       reader = new BufferedReader(new InputStreamReader(new FileInputStream(unitSelectionFile),  "UTF-8"));
       String text=null;

       do {

                if (text.length() != 0) {
                    if (mainHash.get(text)==null)
                        mainHash.put(key, soundUnit);
                }


        } while ((text = reader.readLine())!= null);
  • 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-05T18:02:44+00:00Added an answer on June 5, 2026 at 6:02 pm

    Yes, most likely the hashtable is simply to large. I did a test on a Galaxy Nexus, which is a rather new phone, and it ran out of memory after 230k entries, with unique keys and values about 8 chars long. I would suggest to put your data in a database instead.

    Your reader should not be an issue, since BufferedReader only uses a small amount of memory.

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

Sidebar

Related Questions

I have problem when I try insert some data to Informix TEXT column via
I have a problem, when I try to use a outer script that uses
i am having this problem try to use the cocos2d CCScrollLayer I have added
I have the problem that when I try to copy some files from php
I have a problem : I try to use the sfNumberValidator, but it doesn't
I have a display problem when I try to use a ajax combobox inside
I have a problem with a databinding in WPF. When I try to use
I have a problem. This is my code. When i try to use the
I have a problem on ICS when I try to use google calendar api.
I have this problem when I try to use script/generate: $ script/generate start /Users/gst/.gem/ruby/1.8/gems/hpricot-0.8.1/lib/fast_xs.bundle:

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.