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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:46:53+00:00 2026-05-23T11:46:53+00:00

I am parsing a binary file on the device and storing fields I care

  • 0

I am parsing a binary file on the device and storing fields I care about in arrays. These files can lead to arrays that are 100,000’s in size. Naturally, java tells me I run out of memory (I think android only allows 16MB per application).

Is there another way to grab this data?

Basically, I parse for points and color information, store it in arrays, then use vertexBuffers to draw these in OpenGL. Storing them in a database wouldn’t help me, would it?

Thank you!

EDIT:
I run a parse on a file with 482,000 points. It stores position and color without crashing. I see this in debugger:

Grow heap (frag case) to 43.164MB for 23156032-byte allocation
Forcing collection of SoftReferences for 30874704-byte allocation
Out of memory on a 30874704-byte allocation

The error populates on java.nio.ByteBuffer.allocateDirect
I’ve included that code area below:

//Parse file and populate arrays
PointParser(fileName, header);

// a float is 4 bytes, therefore we multiply the number if 
// vertices with 4.
ByteBuffer vbb = ByteBuffer.allocateDirect(lasVertices.length * 4);
vbb.order(ByteOrder.nativeOrder());
vertexBuffer = vbb.asFloatBuffer();
vertexBuffer.put(lasVertices);
vertexBuffer.position(0);   

ByteBuffer cbb = ByteBuffer.allocateDirect(lasColors.length * 4);
cbb.order(ByteOrder.nativeOrder());
colorBuffer = cbb.asFloatBuffer();
colorBuffer.put(lasColors);
colorBuffer.position(0);    

…

public void draw(GL10 gl) {
        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
        gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer);
        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
        gl.glPointSize(0.6f);
        gl.glDrawArrays(GL10.GL_POINTS, 0, numVertices);
        gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    }
  • 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-23T11:46:53+00:00Added an answer on May 23, 2026 at 11:46 am

    I don’t know if it could help you, but there are lots of interresting advices from google aubout memory management here: http://dubroy.com/blog/google-io-memory-management-for-android-apps/

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

Sidebar

Related Questions

I'm parsing a binary file in javascript that is storing two pieces of information
I am parsing binary file. File size can be large. I want to search
I'm parsing a binary file format. It encodes an integer using four bytes in
I am reading a binary file into a parsing program. I will need to
Does anybody recommend a design pattern for taking a binary data file, parsing parts
I'm parsing text from a file and storing it in a string. The problem
I've been parsing through some log files and I've found that some of the
I am parsing a binary file using a specification. The file comes in big-endian
I have a large binary file to parse, and i am not sure about
I am parsing a binary log file. The log file is formatted as follows:

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.