Program: 22651
Project: 22651
Buggy source:
private void createIndexObjectMemoryEfficient(){
  StopWatch global=new StopWatch();
  StopWatch st=new StopWatch();
  SequenceLog64 objectCount=new SequenceLog64(BitUtil.log2(seqZ.getNumberOfElements()));
  long maxCount=0;
  for (long i=0; i < seqZ.getNumberOfElements(); i++) {
    long val=seqZ.get(i);
    if (val == 0) {
      throw new RuntimeException("String_Node_Str");
    }
    if (objectCount.getNumberOfElements() < val) {
      objectCount.resize(val);
    }
    long count=objectCount.get(val - 1) + 1;
    maxCount=count > maxCount ? count : maxCount;
    objectCount.set(val - 1,count);
  }
  System.out.println("String_Node_Str" + st.stopAndShow() + "String_Node_Str"+ maxCount);
  st.reset();
  Bitmap375 bitmapIndex=new Bitmap375(seqZ.getNumberOfElements());
  long tmpCount=0;
  for (long i=0; i < objectCount.getNumberOfElements(); i++) {
    tmpCount+=objectCount.get(i);
    bitmapIndex.set(tmpCount - 1,true);
  }
  bitmapIndex.set(seqZ.getNumberOfElements() - 1,true);
  System.out.println("String_Node_Str" + st.stopAndShow());
  objectCount=null;
  st.reset();
  SequenceLog64 objectInsertedCount=new SequenceLog64(BitUtil.log2(maxCount),bitmapIndex.countOnes());
  objectInsertedCount.resize(bitmapIndex.countOnes());
  SequenceLog64 objectArray=new SequenceLog64(BitUtil.log2(seqY.getNumberOfElements()),seqZ.getNumberOfElements());
  objectArray.resize(seqZ.getNumberOfElements());
  for (long i=0; i < seqZ.getNumberOfElements(); i++) {
    long objectValue=seqZ.get(i);
    long posY=i > 0 ? bitmapZ.rank1(i - 1) : 0;
    long insertBase=objectValue == 1 ? 0 : bitmapIndex.select1(objectValue - 1) + 1;
    long insertOffset=objectInsertedCount.get(objectValue - 1);
    objectInsertedCount.set(objectValue - 1,insertOffset + 1);
    objectArray.set(insertBase + insertOffset,posY);
  }
  System.out.println("String_Node_Str" + st.stopAndShow());
  objectInsertedCount=null;
  st.reset();
  long object=1;
  long first=0;
  long last=bitmapIndex.select1(object) + 1;
  do {
    long listLen=last - first;
    if (listLen == 2) {
      long aPos=objectArray.get(first);
      long a=seqY.get(aPos);
      long bPos=objectArray.get(last);
      long b=seqY.get(bPos);
      if (a > b) {
        objectArray.set(first,bPos);
        objectArray.set(last,aPos);
      }
    }
 else     if (listLen > 2) {
class Pair {
        int valueY;
        int positionY;
      }
      ;
      ArrayList<Pair> list=new ArrayList<Pair>((int)listLen);
      for (long i=first; i < last; i++) {
        Pair p=new Pair();
        p.positionY=(int)objectArray.get(i);
        p.valueY=(int)seqY.get(p.positionY);
        list.add(p);
      }
      Collections.sort(list,new Comparator<Pair>(){
        @Override public int compare(        Pair o1,        Pair o2){
          if (o1.valueY == o2.valueY) {
            return o1.positionY - o2.positionY;
          }
          return o1.valueY - o2.valueY;
        }
      }
);
      for (long i=first; i < last; i++) {
        objectArray.set(i,list.get((int)(i - first)).positionY);
      }
    }
    first=last;
    last=bitmapIndex.select1(object) + 1;
    object++;
  }
 while (object <= bitmapIndex.countOnes());
  System.out.println("String_Node_Str" + st.stopAndShow());
  st.reset();
  SequenceLog64 predCount=new SequenceLog64(BitUtil.log2(seqY.getNumberOfElements()));
  for (long i=0; i < seqY.getNumberOfElements(); i++) {
    long val=seqY.get(i);
    if (predCount.getNumberOfElements() < val) {
      predCount.resize(val);
    }
    predCount.set(val - 1,predCount.get(val - 1) + 1);
  }
  predCount.trimToSize();
  System.out.println("String_Node_Str" + st.stopAndShow());
  this.predicateCount=predCount;
  st.reset();
  this.indexZ=objectArray;
  this.bitmapIndexZ=bitmapIndex;
  this.adjIndex=new AdjacencyList(this.indexZ,this.bitmapIndexZ);
  System.out.println("String_Node_Str" + global.stopAndShow());
}

Fixed version (ground truth):
private void createIndexObjectMemoryEfficient(){
  StopWatch global=new StopWatch();
  StopWatch st=new StopWatch();
  SequenceLog64 objectCount=new SequenceLog64(BitUtil.log2(seqZ.getNumberOfElements()));
  long maxCount=0;
  for (long i=0; i < seqZ.getNumberOfElements(); i++) {
    long val=seqZ.get(i);
    if (val == 0) {
      throw new RuntimeException("String_Node_Str");
    }
    if (objectCount.getNumberOfElements() < val) {
      objectCount.resize(val);
    }
    long count=objectCount.get(val - 1) + 1;
    maxCount=count > maxCount ? count : maxCount;
    objectCount.set(val - 1,count);
  }
  System.out.println("String_Node_Str" + st.stopAndShow() + "String_Node_Str"+ maxCount);
  st.reset();
  Bitmap375 bitmapIndex=new Bitmap375(seqZ.getNumberOfElements());
  long tmpCount=0;
  for (long i=0; i < objectCount.getNumberOfElements(); i++) {
    tmpCount+=objectCount.get(i);
    bitmapIndex.set(tmpCount - 1,true);
  }
  bitmapIndex.set(seqZ.getNumberOfElements() - 1,true);
  System.out.println("String_Node_Str" + st.stopAndShow());
  objectCount=null;
  st.reset();
  SequenceLog64 objectInsertedCount=new SequenceLog64(BitUtil.log2(maxCount),bitmapIndex.countOnes());
  objectInsertedCount.resize(bitmapIndex.countOnes());
  SequenceLog64 objectArray=new SequenceLog64(BitUtil.log2(seqY.getNumberOfElements()),seqZ.getNumberOfElements());
  objectArray.resize(seqZ.getNumberOfElements());
  for (long i=0; i < seqZ.getNumberOfElements(); i++) {
    long objectValue=seqZ.get(i);
    long posY=i > 0 ? bitmapZ.rank1(i - 1) : 0;
    long insertBase=objectValue == 1 ? 0 : bitmapIndex.select1(objectValue - 1) + 1;
    long insertOffset=objectInsertedCount.get(objectValue - 1);
    objectInsertedCount.set(objectValue - 1,insertOffset + 1);
    objectArray.set(insertBase + insertOffset,posY);
  }
  System.out.println("String_Node_Str" + st.stopAndShow());
  objectInsertedCount=null;
  st.reset();
  long object=1;
  long first=0;
  long last=bitmapIndex.select1(object) + 1;
  do {
    long listLen=last - first;
    if (listLen == 2) {
      long aPos=objectArray.get(first);
      long a=seqY.get(aPos);
      long bPos=objectArray.get(first + 1);
      long b=seqY.get(bPos);
      if (a > b) {
        objectArray.set(first,bPos);
        objectArray.set(first + 1,aPos);
      }
    }
 else     if (listLen > 2) {
class Pair {
        int valueY;
        int positionY;
      }
      ;
      ArrayList<Pair> list=new ArrayList<Pair>((int)listLen);
      for (long i=first; i < last; i++) {
        Pair p=new Pair();
        p.positionY=(int)objectArray.get(i);
        p.valueY=(int)seqY.get(p.positionY);
        list.add(p);
      }
      Collections.sort(list,new Comparator<Pair>(){
        @Override public int compare(        Pair o1,        Pair o2){
          if (o1.valueY == o2.valueY) {
            return o1.positionY - o2.positionY;
          }
          return o1.valueY - o2.valueY;
        }
      }
);
      for (long i=first; i < last; i++) {
        objectArray.set(i,list.get((int)(i - first)).positionY);
      }
    }
    first=last;
    last=bitmapIndex.select1(object) + 1;
    object++;
  }
 while (object <= bitmapIndex.countOnes());
  System.out.println("String_Node_Str" + st.stopAndShow());
  st.reset();
  SequenceLog64 predCount=new SequenceLog64(BitUtil.log2(seqY.getNumberOfElements()));
  for (long i=0; i < seqY.getNumberOfElements(); i++) {
    long val=seqY.get(i);
    if (predCount.getNumberOfElements() < val) {
      predCount.resize(val);
    }
    predCount.set(val - 1,predCount.get(val - 1) + 1);
  }
  predCount.trimToSize();
  System.out.println("String_Node_Str" + st.stopAndShow());
  this.predicateCount=predCount;
  st.reset();
  this.indexZ=objectArray;
  this.bitmapIndexZ=bitmapIndex;
  this.adjIndex=new AdjacencyList(this.indexZ,this.bitmapIndexZ);
  System.out.println("String_Node_Str" + global.stopAndShow());
}