org.apache.lucene.codecs.uniformsplit.RamUsageUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lucene-codecs Show documentation
Show all versions of lucene-codecs Show documentation
Codecs and postings formats for Apache Lucene.
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.codecs.uniformsplit;
import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_ARRAY_HEADER;
import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF;
import static org.apache.lucene.util.RamUsageEstimator.alignObjectSize;
import static org.apache.lucene.util.RamUsageEstimator.shallowSizeOfInstance;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.index.TermState;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.RamUsageEstimator;
/**
* Utility methods to estimate the RAM usage of objects. It relies on {@link RamUsageEstimator}.
*
* @lucene.experimental
*/
public class RamUsageUtil {
private static final long BYTES_REF_BASE_RAM_USAGE = shallowSizeOfInstance(BytesRef.class);
private static final long BYTES_REF_BUILDER_BASE_RAM_USAGE =
shallowSizeOfInstance(BytesRefBuilder.class);
private static final long HASH_MAP_BASE_RAM_USAGE =
RamUsageEstimator.shallowSizeOfInstance(HashMap.class);
private static final long HASH_MAP_ENTRY_BASE_RAM_USAGE;
private static final long UNMODIFIABLE_ARRAY_LIST_BASE_RAM_USAGE;
static {
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy