congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DataType.getMemory
Code IndexAdd Tabnine to your IDE (free)

How to use
getMemory
method
in
org.h2.mvstore.type.DataType

Best Java code snippets using org.h2.mvstore.type.DataType.getMemory (Showing top 20 results out of 315)

origin: com.h2database/h2

@Override
public int getMemory(Object obj) {
  VersionedValue v = (VersionedValue) obj;
  return valueType.getMemory(v.value) + 8;
}
origin: com.h2database/h2

@Override
public int getMemory(Object obj) {
  Object[] array = (Object[]) obj;
  int size = 0;
  for (int i = 0; i < arrayLength; i++) {
    DataType t = elementTypes[i];
    Object o = array[i];
    if (o != null) {
      size += t.getMemory(o);
    }
  }
  return size;
}
origin: com.h2database/h2

@Override
public int getMemory(Object obj) {
  DataType t = getType(obj);
  if (t == this) {
    return averageSize;
  }
  return t.getMemory(obj);
}
origin: com.h2database/h2

/**
 * Replace the value at an index in this page.
 *
 * @param index the index
 * @param value the new value
 * @return the old value
 */
public Object setValue(int index, Object value) {
  Object old = values[index];
  // this is slightly slower:
  // values = Arrays.copyOf(values, values.length);
  values = values.clone();
  DataType valueType = map.getValueType();
  if(isPersistent()) {
    addMemory(valueType.getMemory(value) -
        valueType.getMemory(old));
  }
  values[index] = value;
  return old;
}
origin: com.h2database/h2

/**
 * Replace the key at an index in this page.
 *
 * @param index the index
 * @param key the new key
 */
public void setKey(int index, Object key) {
  // this is slightly slower:
  // keys = Arrays.copyOf(keys, keys.length);
  keys = keys.clone();
  if(isPersistent()) {
    Object old = keys[index];
    DataType keyType = map.getKeyType();
    int mem = keyType.getMemory(key);
    if (old != null) {
      mem -= keyType.getMemory(old);
    }
    addMemory(mem);
  }
  keys[index] = key;
}
origin: com.h2database/h2

private void recalculateMemory() {
  int mem = DataUtils.PAGE_MEMORY;
  DataType keyType = map.getKeyType();
  for (Object key : keys) {
    mem += keyType.getMemory(key);
  }
  if (this.isLeaf()) {
    DataType valueType = map.getValueType();
    for (int i = 0; i < keys.length; i++) {
      mem += valueType.getMemory(values[i]);
    }
  } else {
    mem += this.getRawChildPageCount() * DataUtils.PAGE_MEMORY_CHILD;
  }
  addMemory(mem - memory);
}
origin: com.h2database/h2

/**
 * Insert a key-value pair into this leaf.
 *
 * @param index the index
 * @param key the key
 * @param value the value
 */
public void insertLeaf(int index, Object key, Object value) {
  int len = keys.length + 1;
  Object[] newKeys = new Object[len];
  DataUtils.copyWithGap(keys, newKeys, len - 1, index);
  keys = newKeys;
  Object[] newValues = new Object[len];
  DataUtils.copyWithGap(values, newValues, len - 1, index);
  values = newValues;
  keys[index] = key;
  values[index] = value;
  totalCount++;
  if(isPersistent()) {
    addMemory(map.getKeyType().getMemory(key) +
        map.getValueType().getMemory(value));
  }
}
origin: com.h2database/h2

if(isPersistent()) {
  Object old = keys[keyIndex];
  addMemory(-map.getKeyType().getMemory(old));
  if(isPersistent()) {
    Object old = values[index];
    addMemory(-map.getValueType().getMemory(old));
origin: com.h2database/h2

/**
 * Insert a child page into this node.
 *
 * @param index the index
 * @param key the key
 * @param childPage the child page
 */
public void insertNode(int index, Object key, Page childPage) {
  Object[] newKeys = new Object[keys.length + 1];
  DataUtils.copyWithGap(keys, newKeys, keys.length, index);
  newKeys[index] = key;
  keys = newKeys;
  int childCount = children.length;
  PageReference[] newChildren = new PageReference[childCount + 1];
  DataUtils.copyWithGap(children, newChildren, childCount, index);
  newChildren[index] = new PageReference(
      childPage, childPage.getPos(), childPage.totalCount);
  children = newChildren;
  totalCount += childPage.totalCount;
  if(isPersistent()) {
    addMemory(map.getKeyType().getMemory(key) +
        DataUtils.PAGE_MEMORY_CHILD);
  }
}
origin: org.wowtools/h2

@Override
public int getMemory(Object obj) {
  Object[] array = (Object[]) obj;
  int size = 0;
  for (int i = 0; i < arrayLength; i++) {
    DataType t = elementTypes[i];
    Object o = array[i];
    if (o != null) {
      size += t.getMemory(o);
    }
  }
  return size;
}
origin: org.wowtools/h2

@Override
public int getMemory(Object obj) {
  VersionedValue v = (VersionedValue) obj;
  return valueType.getMemory(v.value) + 8;
}
origin: com.eventsourcing/h2

@Override
public int getMemory(Object obj) {
  VersionedValue v = (VersionedValue) obj;
  return valueType.getMemory(v.value) + 8;
}
origin: com.eventsourcing/h2

@Override
public int getMemory(Object obj) {
  Object[] array = (Object[]) obj;
  int size = 0;
  for (int i = 0; i < arrayLength; i++) {
    DataType t = elementTypes[i];
    Object o = array[i];
    if (o != null) {
      size += t.getMemory(o);
    }
  }
  return size;
}
origin: com.h2database/h2-mvstore

@Override
public int getMemory(Object obj) {
  DataType t = getType(obj);
  if (t == this) {
    return averageSize;
  }
  return t.getMemory(obj);
}
origin: org.wowtools/h2

@Override
public int getMemory(Object obj) {
  DataType t = getType(obj);
  if (t == this) {
    return averageSize;
  }
  return t.getMemory(obj);
}
origin: com.eventsourcing/h2

@Override
public int getMemory(Object obj) {
  DataType t = getType(obj);
  if (t == this) {
    return averageSize;
  }
  return t.getMemory(obj);
}
origin: org.wowtools/h2

/**
 * Replace the value at an index in this page.
 *
 * @param index the index
 * @param value the new value
 * @return the old value
 */
public Object setValue(int index, Object value) {
  Object old = values[index];
  // this is slightly slower:
  // values = Arrays.copyOf(values, values.length);
  values = values.clone();
  DataType valueType = map.getValueType();
  addMemory(valueType.getMemory(value) -
      valueType.getMemory(old));
  values[index] = value;
  return old;
}
origin: com.eventsourcing/h2

/**
 * Replace the value at an index in this page.
 *
 * @param index the index
 * @param value the new value
 * @return the old value
 */
public Object setValue(int index, Object value) {
  Object old = values[index];
  // this is slightly slower:
  // values = Arrays.copyOf(values, values.length);
  values = values.clone();
  DataType valueType = map.getValueType();
  addMemory(valueType.getMemory(value) -
      valueType.getMemory(old));
  values[index] = value;
  return old;
}
origin: org.apache.jackrabbit/oak-store-document

private void write(final K key, final V value) {
  cache.switchGenerationIfNeeded();
  if (value == null) {
    map.remove(key);
  } else {
    if (!type.shouldCache(nodeStore, key)){
      return;
    }
    map.put(key, value);
    long memory = 0L;
    memory += (key == null ? 0L: keyType.getMemory(key));
    memory += (value == null ? 0L: valueType.getMemory(value));
    stats.markBytesWritten(memory);
    stats.markPut();
  }
}
origin: apache/jackrabbit-oak

private void write(final K key, final V value) {
  cache.switchGenerationIfNeeded();
  if (value == null) {
    map.remove(key);
  } else {
    if (!type.shouldCache(nodeStore, key)){
      return;
    }
    map.put(key, value);
    long memory = 0L;
    memory += (key == null ? 0L: keyType.getMemory(key));
    memory += (value == null ? 0L: valueType.getMemory(value));
    stats.markBytesWritten(memory);
    stats.markPut();
  }
}
org.h2.mvstore.typeDataTypegetMemory

Javadoc

Estimate the used memory in bytes.

Popular methods of DataType

  • read
    Read a list of objects.
  • write
    Write a list of objects.
  • compare
    Compare two keys.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now