in Education by
Is it possible to memory-map huge files (multiple GBs) in Java? This method of FileChannel looks promising: MappedByteBuffer map(FileChannel.MapMode mode, long position, long size) Both position and size allow for 64-bit values -- so far, so good. MappedByteBuffer, however, only provides methods for 32-bit positions (get(int index), position(int newPosition), etc.), which seems to imply that I cannot map files larger than 2 GB. How can I get around this limitation? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Take a look at Using a memory mapped file for a huge matrix code which shows how to create a list of MappedByteBuffer, each smaller then 2 GB, to map the entire file: private static final int MAPPING_SIZE = 1 << 30; ... long size = 8L * width * height; for (long offset = 0; offset < size; offset += MAPPING_SIZE) { long size2 = Math.min(size - offset, MAPPING_SIZE); mappings.add(raf.getChannel().map(FileChannel.MapMode.READ_WRITE, offset, size2)); } As per JDK-6347833 (fs) Enhance MappedByteBuffer to support sizes >2GB on 64 bit platforms the reason for the 2 GB limit is: A MappedByteBuffer is a ByteBuffer with additional operations to support memory-mapped file regions. To support mapping a region larger than Integer.MAX_VALUE would require a parallel hierarchy of classes. For now the only solution is create multiple MappedByteBuffers where each corresponds to a region that is no larger than 2GB.

Related questions

0 votes
    Is it possible to memory-map huge files (multiple GBs) in Java? This method of FileChannel looks promising: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    Is it possible to memory-map huge files (multiple GBs) in Java? This method of FileChannel looks promising: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    Is it possible to store a huge amount of data in a memory engine using Tableau? If yes, how can we achieve that?...
asked Oct 30, 2020 in Technology by JackTerrance
0 votes
    I am loading a (5gb compressed file) into memory (aws), creating a dataframe(in spark) and trying ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    The _____________ system is widely used for mapping from Java objects to relations. (a) Hibernate (b) ... , Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    an operatingsystem______ memory to____ files and folders a) allocates,store b) locates,manage. c)allocates,program. d)stores,allocate Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    Simplest definition of Memory-Mapped files?...
asked Nov 22, 2020 in Technology by JackTerrance
0 votes
    ________ is a collection of data that is huge in volume, yet growing exponentially with time. A. Big Dataabase B. Big Data C. Big Datafile D. Big DBMS...
asked Dec 2, 2022 in Education by JackTerrance
0 votes
    I am using the Kafka Streams Processor API to construct a Kafka Streams application to retrieve messages from ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am using the Kafka Streams Processor API to construct a Kafka Streams application to retrieve messages from ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    ____________ function can be used to select the random sample of size n' from a huge dataset. (a) ... Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    WHICH TYPE OF CHART IS USED FOR REPRESENTING HUGE AMOUNT OF DATA. (i) BAR (ii) LINE (iii) SCATTER Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    In _____, the machine is trained with huge amounts of data which helps it in training itself ... proposed by,electromagnetic theory engineering physics,electromagnetic theory nptel...
asked Nov 12, 2021 in Education by JackTerrance
...