diff --git a/pom.xml b/pom.xml index 89f53fb7a..f132c36e3 100755 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ net.openhft chronicle-bom pom - 1.3.0 + 1.3.3-SNAPSHOT import diff --git a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java index 0c99412cf..ceebf549d 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java @@ -16,6 +16,7 @@ package net.openhft.chronicle.hash.impl; +import net.openhft.chronicle.core.OS; import net.openhft.chronicle.hash.ChronicleHash; import net.openhft.chronicle.hash.ExternalHashQueryContext; import net.openhft.chronicle.hash.KeyContext; @@ -26,7 +27,6 @@ import net.openhft.chronicle.hash.serialization.SizeMarshaller; import net.openhft.chronicle.hash.serialization.internal.MetaBytesInterop; import net.openhft.chronicle.hash.serialization.internal.MetaProvider; import net.openhft.chronicle.hash.serialization.internal.SerializationBuilder; -import net.openhft.lang.Jvm; import net.openhft.lang.io.Bytes; import net.openhft.lang.io.BytesStore; import net.openhft.lang.io.MappedStore; @@ -193,38 +193,8 @@ public abstract class VanillaChronicleHash GIGABYTES.toBytes(4L)) { - System.out.printf( - "WARNING: On Windows, you probably cannot create a ChronicleMap\n" + - "of more than 4 GB. The configured map requires %.2f GB of " + - "off-heap memory.\n", - offHeapMapSizeInGb); - } - try { - long freePhysicalMemory = Jvm.freePhysicalMemoryOnWindowsInBytes(); - if (offHeapMapSize > freePhysicalMemory * 0.9) { - double freePhysicalMemoryInGb = freePhysicalMemory * 1.0 / oneGb; - System.out.printf( - "WARNING: On Windows, you probably cannot create a ChronicleMap\n" + - "of more than 90%% of available free memory in the system.\n" + - "The configured map requires %.2f GB of off-heap memory.\n" + - "There is only %.2f GB of free physical memory in the system.\n", - offHeapMapSizeInGb, freePhysicalMemoryInGb); - - } - } catch (IOException e) { - // ignore -- anyway we just warn the user - } - } - public final void createMappedStoreAndSegments(File file) throws IOException { - warnOnWindows(); + OS.warnOnWindows(sizeInBytes()); createMappedStoreAndSegments(new MappedStore(file, FileChannel.MapMode.READ_WRITE, sizeInBytes(), BytesMarshallableSerializer.create())); } diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java index 6813fdd82..1696839de 100755 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java @@ -18,6 +18,7 @@ package net.openhft.chronicle.map; +import net.openhft.chronicle.core.OS; import net.openhft.chronicle.hash.ChronicleHashBuilder; import net.openhft.chronicle.hash.ChronicleHashInstanceBuilder; import net.openhft.chronicle.hash.impl.ChronicleHashBuilderImpl; @@ -1359,7 +1360,7 @@ public final class ChronicleMapBuilder implements try { // pushingToMapEventListener(); VanillaChronicleMap map = newMap(singleHashReplication, channel); - map.warnOnWindows(); + OS.warnOnWindows(map.sizeInBytes()); BytesStore bytesStore = new DirectStore(JDKObjectSerializer.INSTANCE, map.sizeInBytes(), true); map.createMappedStoreAndSegments(bytesStore);