You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at high memory usage in one of our components, we noticed that for every MultiMap created by a MultimapBuilder, we have a Supplier too (in our case it is a HashSetSupplier, but it applies to other Suppliers too)
the reason for that is that we do:
public static final MultimapBuilder.SetMultimapBuilder<Object, Object> RELATIONS_MAP_BUILDER = MultimapBuilder
.hashKeys(2)
.hashSetValues(1);
which in turn calls this Guava code
public SetMultimapBuilder<K0, Object> hashSetValues(final int expectedValuesPerKey) {
checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey");
return new SetMultimapBuilder<K0, Object>() {
@Override
public <K extends K0, V> SetMultimap<K, V> build() {
return Multimaps.newSetMultimap(
MultimapBuilderWithKeys.this.<K, V>createMap(),
new HashSetSupplier<V>(expectedValuesPerKey));
}
};
}
This creates a new hashSetSupplier every time build is invoked.
This looks incorrect to me, and the suppliers should be properties of the newly returned builder, shouldn't they?
The text was updated successfully, but these errors were encountered:
Looking at high memory usage in one of our components, we noticed that for every MultiMap created by a MultimapBuilder, we have a Supplier too (in our case it is a HashSetSupplier, but it applies to other Suppliers too)
the reason for that is that we do:
which in turn calls this Guava code
This creates a new
hashSetSupplier
every time build is invoked.This looks incorrect to me, and the suppliers should be properties of the newly returned builder, shouldn't they?
The text was updated successfully, but these errors were encountered: