Example usage for org.apache.lucene.util RamUsageEstimator shallowSizeOf

List of usage examples for org.apache.lucene.util RamUsageEstimator shallowSizeOf

Introduction

In this page you can find the example usage for org.apache.lucene.util RamUsageEstimator shallowSizeOf.

Prototype

public static long shallowSizeOf(Object obj) 

Source Link

Document

Estimates a "shallow" memory usage of the given object.

Usage

From source file:com.lucure.core.codec.CompressingStoredFieldsIndexReader.java

License:Apache License

@Override
public long ramBytesUsed() {
    long res = BASE_RAM_BYTES_USED;

    res += RamUsageEstimator.shallowSizeOf(docBasesDeltas);
    for (PackedInts.Reader r : docBasesDeltas) {
        res += r.ramBytesUsed();//  w  w  w .j av a2s  .c  om
    }
    res += RamUsageEstimator.shallowSizeOf(startPointersDeltas);
    for (PackedInts.Reader r : startPointersDeltas) {
        res += r.ramBytesUsed();
    }

    res += RamUsageEstimator.sizeOf(docBases);
    res += RamUsageEstimator.sizeOf(startPointers);
    res += RamUsageEstimator.sizeOf(avgChunkDocs);
    res += RamUsageEstimator.sizeOf(avgChunkSizes);

    return res;
}

From source file:monad.face.internal.MonadSparseFixedBitSet.java

License:Apache License

/** Create a {@link MonadSparseFixedBitSet} that can contain bits between
 *  <code>0</code> included and <code>length</code> excluded. */
public MonadSparseFixedBitSet(int length) {
    if (length < 1) {
        throw new IllegalArgumentException("length needs to be >= 1");
    }/*from w  w  w . j av a 2s  .c o m*/
    this.length = length;
    final int blockCount = blockCount(length);
    indices = new long[blockCount];
    bits = new long[blockCount][];
    ramBytesUsed = BASE_RAM_BYTES_USED + RamUsageEstimator.shallowSizeOf(indices)
            + RamUsageEstimator.shallowSizeOf(bits);
}

From source file:org.elasticsearch.index.engine.IndexVersionValue.java

License:Apache License

@Override
public long ramBytesUsed() {
    return RAM_BYTES_USED + RamUsageEstimator.shallowSizeOf(translogLocation);
}

From source file:org.elasticsearch.xpack.core.security.authz.permission.FieldPermissions.java

License:Open Source License

/** Constructor that enables field-level security based on include/exclude rules. Exclude rules
 *  have precedence over include rules. */
FieldPermissions(FieldPermissionsDefinition fieldPermissionsDefinition, Automaton permittedFieldsAutomaton) {
    if (permittedFieldsAutomaton.isDeterministic() == false && permittedFieldsAutomaton.getNumStates() > 1) {
        // we only accept deterministic automata so that the CharacterRunAutomaton constructor
        // directly wraps the provided automaton
        throw new IllegalArgumentException("Only accepts deterministic automata");
    }/*from  w w w  . j a v a  2 s.  co m*/
    this.fieldPermissionsDefinition = fieldPermissionsDefinition;
    this.originalAutomaton = permittedFieldsAutomaton;
    this.permittedFieldsAutomaton = new CharacterRunAutomaton(permittedFieldsAutomaton);
    // we cache the result of isTotal since this might be a costly operation
    this.permittedFieldsAutomatonIsTotal = Operations.isTotal(permittedFieldsAutomaton);

    long ramBytesUsed = BASE_FIELD_PERM_DEF_BYTES;

    for (FieldGrantExcludeGroup group : fieldPermissionsDefinition.getFieldGrantExcludeGroups()) {
        ramBytesUsed += BASE_FIELD_GROUP_BYTES + BASE_HASHSET_ENTRY_SIZE;
        if (group.getGrantedFields() != null) {
            ramBytesUsed += RamUsageEstimator.shallowSizeOf(group.getGrantedFields());
        }
        if (group.getExcludedFields() != null) {
            ramBytesUsed += RamUsageEstimator.shallowSizeOf(group.getExcludedFields());
        }
    }
    ramBytesUsed += permittedFieldsAutomaton.ramBytesUsed();
    ramBytesUsed += runAutomatonRamBytesUsed(permittedFieldsAutomaton);
    this.ramBytesUsed = ramBytesUsed;
}

From source file:roar.api.services.RoarSparseFixedBitSet.java

License:Apache License

/** Create a {@link RoarSparseFixedBitSet} that can contain bits between
 *  <code>0</code> included and <code>length</code> excluded. */
public RoarSparseFixedBitSet(int length) {
    if (length < 1) {
        throw new IllegalArgumentException("length needs to be >= 1");
    }/*from www  .j  av a  2  s . c  o m*/
    this.length = length;
    final int blockCount = blockCount(length);
    indices = new long[blockCount];
    bits = new long[blockCount][];
    ramBytesUsed = BASE_RAM_BYTES_USED + RamUsageEstimator.shallowSizeOf(indices)
            + RamUsageEstimator.shallowSizeOf(bits);
}