JDK-4496703 : (bf) Buffer classes limited by 32-bit addressing
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.0,1.4.1,5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS:
    generic,linux,solaris_7,windows_2000,windows_xp generic,linux,solaris_7,windows_2000,windows_xp
  • CPU: generic,x86,sparc,itanium
  • Submitted: 2001-08-27
  • Updated: 2018-02-09
  • Resolved: 2018-02-09
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
Name: nt126004			Date: 08/27/2001


% java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)


java.nio.Buffer may have problems with 64bit environments. Many methods
like |capacity| (see
http://puck.informatik.med.uni-giessen.de/java/j2sdk1_4_docs/api/java/nio/Buffer.html#capacity())
return an |int| (or take |int| as a position argument for buffer position - like
|Buffer position(int newPosition)|) - which is 32bit.
But on sparcv9 it may have 64bits (sparcv9 binaries can mmap() files larger than
4GB into process address space), e.g. |long| should be used instead.

This looks pretty urgend as JDK 1.4 is currently in _BETA_-status...
this bug should not be shipped with the FCS version...

BTW: unfortunatley this isn't the only place where JAVA runns into this
32bit vs. 64bit issue... the whole JAVA API needs to be reviewed for
such issues... ;-((
(Review ID: 130656) 
======================================================================

Comments
Resolving as duplicate of JDK-8180628.
09-02-2018

EVALUATION JSR-203 prototyped a new set of buffer classes that are indexex by long. However, they are ugly, not suited for I/O operations, and don't address the needs of folks that really just want 64-bit arrays. An alternative approach that is being examined by the collections group is define a new big array collection type. To support continguous mapping of large files then the collection type could be backed by a mapped region.
28-07-2008

EVALUATION JSR-203 is expected to introduce a parallel set of buffer APIs which support 64-bit indexing.
13-02-2007

EVALUATION This is a fundamental limitation of the java.nio buffer classes, and it is intentional. During the design of the JSR-51 (NIO) specification the expert group considered using long indices in buffers but decided against it since long arithmetic is significantly slower than int arithmetic on 32-bit hardware. A future revision of the specification is likely to address this problem, though the best means for doing so is not yet clear. -- ###@###.### 2002/3/15
03-10-0181