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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:09:18+00:00 2026-05-23T13:09:18+00:00

I parse a binary point cloud file and get large arrays of points and

  • 0

I parse a binary point cloud file and get large arrays of points and their properties. These more often then not run out of memory when allocating towards VBOs before drawing. I need a solution that handles the memory problem but is still fast enough to feed the buffers. Since the application memory space is too small, could I somehow write a ‘file’ to the SD Card and populate the buffers piece-wise from there? I can’t parse the file more than once.

Crashing lines:

-->ByteBuffer vbb = ByteBuffer.allocateDirect(lasVertices.length * 4);
vbb.order(ByteOrder.nativeOrder());
vertexBuffer = vbb.asFloatBuffer();
vertexBuffer.put(lasVertices);
vertexBuffer.position(0);
  • 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-23T13:09:19+00:00Added an answer on May 23, 2026 at 1:09 pm

    Have you looked at using MappedByteBuffer? This should allow you to parse the file once and write a memory optimized binary version to sdcard and read it back in chunks, fast.

    // Open the file here, store it in a field
    RandomAccessFile file = null;
    try {
        mFile = new RandomAccessFile("/sdcard/reallyLargeFile.dat", "r");
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    

    Where you want to render, do this:

    for (int offset = 0; offset < POINTS_SIZE; offset += BLOCK_SIZE)
    if (file != null)
        try {
            MappedByteBuffer buffer = file.getChannel().map(FileChannel.MapMode.READ_ONLY, offset, BLOCK_SIZE);
            vertexBuffer.put(buffer);
    
            vertexBuffer.position(0);
    
            // Render here
        } catch (IOException e) {
            e.printStackTrace();
        }
    

    where POINTS_SIZE = total number of points * 4 ( = size of float) and BUFFER_SIZE is a (divisible) size that doesn’t crash your application. Note that this is a single threaded solution and it might be possible to amortize your cost by using multiple threads reading smaller buffers simultaneously. Also, while this might in practice turne out to be just as efficient as a bunch of seeks and reads, it yields far more elegant and maintainable code. It is also entirely possible that memory mapped files may provide a performance boost on many machines.

    Hope this helps.

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

Sidebar

Related Questions

I am trying to parse a simple binary file in Haskell with the Data.Binary.Get
I have a binary file that I have to parse and I'm using Python.
Yesterday I had to parse a very simple binary data file - the rule
I am trying to read a binary file and parse the bytes I have
Suppose I need to parse a binary file, which starts with three 4-byte magic
I'm trying to parse a binary file format in Haskell (Apple's binary property list
Is it possible to emit and read(parse) binary data(image, file etc)? Like this is
I'm trying to use Preon to parse binary files, which are structured as a
Are there any libraries or guides for how to read and parse binary data
Structs seem like a useful way to parse a binary blob of data (ie

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.