void refCountChanged(Long address,boolean decRefCount,int rc){
  if (!trackReferenceCounts())   return;
  final Object owner=refCountOwner.get();
  if (owner == SKIP_REF_COUNT_TRACKING) {
    return;
  }
  List<RefCountChangeInfo> list=stacktraces.get(address);
  if (list == null) {
    List<RefCountChangeInfo> newList=new ArrayList<RefCountChangeInfo>();
    refCountChangedTestHook(address,decRefCount,rc);
    List<RefCountChangeInfo> old=stacktraces.putIfAbsent(address,newList);
    if (old == null) {
      list=newList;
    }
 else {
      list=old;
    }
  }
  if (decRefCount) {
    if (owner != null) {
synchronized (list) {
        for (int i=0; i < list.size(); i++) {
          RefCountChangeInfo info=list.get(i);
          if (owner instanceof RegionEntry) {
            if (owner == info.getOwner()) {
              if (info.getUseCount() > 0) {
                info.decUseCount();
              }
 else {
                list.remove(i);
              }
              return;
            }
          }
 else           if (owner.equals(info.getOwner())) {
            if (info.getUseCount() > 0) {
              info.decUseCount();
            }
 else {
              list.remove(i);
            }
            return;
          }
        }
      }
    }
  }
  if (list == LOCKED) {
    MemoryAllocatorImpl.debugLog("refCount " + (decRefCount ? "deced" : "inced") + " after orphan detected for @"+ Long.toHexString(address),true);
    return;
  }
  RefCountChangeInfo info=new RefCountChangeInfo(decRefCount,rc,owner);
synchronized (list) {
    for (    RefCountChangeInfo e : list) {
      if (e.isSameCaller(info)) {
        e.incUseCount();
        return;
      }
    }
    list.add(info);
  }
}

void refCountChanged ( Long address , boolean decRefCount , int rc ) { if ( ! trackReferenceCounts ( ) ) return ; final Object owner = refCountOwner . get ( ) ; if ( owner == SKIP_REF_COUNT_TRACKING ) { return ; } List < RefCountChangeInfo > list = stacktraces . get ( address ) ; if ( list == null ) { List < RefCountChangeInfo > newList = new ArrayList < RefCountChangeInfo > ( ) ; refCountChangedTestHook ( address , decRefCount , rc ) ; List < RefCountChangeInfo > old = stacktraces . putIfAbsent ( address , newList ) ; if ( old == null ) { list = newList ; } else { list = old ; } } if ( decRefCount ) { if ( owner != null ) { synchronized ( list ) { for ( int i = 0 ; i < list . size ( ) ; i ++ ) { RefCountChangeInfo info = list . get ( i ) ; if ( owner instanceof RegionEntry ) { if ( owner == info . getOwner ( ) ) { if ( info . getUseCount ( ) > 0 ) { info . decUseCount ( ) ; } else { list . remove ( i ) ; } return ; } } else if ( owner . equals ( info . getOwner ( ) ) ) { if ( info . getUseCount ( ) > 0 ) { info . decUseCount ( ) ; } else { list . remove ( i ) ; } return ; } } } } } if ( list == LOCKED ) { MemoryAllocatorImpl . debugLog ( "refCount " + ( decRefCount ? "deced" : "inced" ) + " after orphan detected for @" + Long . toHexString ( address ) , true ) ; return ; } RefCountChangeInfo info = new RefCountChangeInfo ( decRefCount , rc , owner ) ; synchronized ( list ) { for ( RefCountChangeInfo e : list ) { if ( e . isSameCaller ( info ) ) { e . incUseCount ( ) ; return ; } } list . add ( info ) ; } }
used internally to report that a reference count has changed .
