JDK-6253746 : pointer_delta not used for pointer diff
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 5.0,5.0u6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_10
  • CPU: generic,sparc
  • Submitted: 2005-04-12
  • Updated: 2010-12-07
  • Resolved: 2005-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
1.4.2_13Fixed 6 b37Fixed
Related Reports
Duplicate :  
Duplicate :  
Description
In psMarkSweepDecorator.cpp, the difference between two pointers is taken without using pointer_delta. This caused a crash when the size of the Java heap was greater than 2 Gb and operating in 32-bit mode. With a debug build, there is an assertion failure that says: "deadspace too big for Arrayoop".

#ifdef HP
        size_t sz = pointer_delta(end, q, sizeof(HeapWord*));
#else
        size_t sz = end - q;
#endif

java -Xms2000m -Xmx3400m -Xmn400m -XX:+UseParallelGC MaxOutMemory

import java.util.*;

public class MaxOutMemory {
  public MaxOutMemory() {
    System.out.println("Starting array allocation");
    Collection list = new ArrayList();
    try {
      for (int i = 0; i < 10000000; i++) {
        list.add(new String[100000]);
        if (i % 400 == 0) {
          System.out.println("Executing GC i=" + i);
          System.gc();
        }
      }
     }
    catch (Exception ex) {
      ex.printStackTrace();
    }

  }

  public static void main(String args[]) {
      MaxOutMemory m = new MaxOutMemory();

      System.exit(95);
  }
}

I could not reproduce this failure on a Sun machine because when I ran the test I got a different assert failure.

#  Internal Error (/BUILD_AREA/jdk1.5.0/hotspot/src/share/vm/gc_implementation/p
arallelScavenge/psPromotionLAB.cpp, 134 [ Patched ]), pid=3859, tid=8
#
# Java VM: Java HotSpot(TM) Server VM (1.5.0-b64-debug interpreted mode)
#
# Error: assert(_start_array->covered_region().contains(lab),"Sanity")
###@###.### 2005-04-12 01:11:46 GMT

Comments
SUGGESTED FIX See suggested fix in description section. ###@###.### 2005-04-25 18:35:05 GMT The fix was delivered by Jon Masamitsu into gc_baseline recently; see below; this should appear in JDK 6.0 post-b35, i am guessing. Event: putback-to Parent workspace: /net/jano.sfbay/export/disk05/hotspot/ws/main/gc_baseline (jano.sfbay:/export/disk05/hotspot/ws/main/gc_baseline) Child workspace: /net/prt-web.sfbay/prt-workspaces/20050429233937.jmasa.gc_baseline_6253746/workspace (prt-web:/net/prt-web.sfbay/prt-workspaces/20050429233937.jmasa.gc_baseline_6253746/workspace) User: jmasa Comment: --------------------------------------------------------- Original workspace: producer:/export3/jmasa/gc_baseline_6253746 Submitter: jmasa Archived data: /net/prt-archiver.sfbay/data/archived_workspaces/main/gc_baseline/2005/20050429233937.jmasa.gc_baseline_6253746/ Webrev: http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/gc_baseline/2005/20050429233937.jmasa.gc_baseline_6253746/workspace/webrevs/webrev-2005.04.30/index.html Fixed 6253746: pointer_delta not used for pointer diff Reviewed by: Ramki, Paul, John Fix verified (y/n): y Verification testing: Ran the test program in the bug report. The program failed after 24 hours without the fix and ran for ~60 hours successfully with the fix. Other testing: runThese with fastdebug on sparc -testbase_gc -testbase_vm -quick Files: update: src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp Examined files: 3240 Contents Summary: 1 update 3239 no action (unchanged) ###@###.### 2005-05-04 01:22:55 GMT
25-04-2005

EVALUATION See the comments and description sections. Use pointer_delta() as indicated. Audit the rest of PSMarkSweep for other instances where pointer_delta() should be used. ###@###.### 2005-04-22 17:17:36 GMT I didn't find any other instances of this problem in PSMarkSweep. I have not been able to reproduce this bug with b33. The bug is self evident so I'm going to put this fix back as a partial fix and will continue to try reproduce the failure. ###@###.### 2005-04-25 18:35:05 GMT
22-04-2005