diff --git a/README.md b/README.md index a4bba415b..79d8b1216 100644 --- a/README.md +++ b/README.md @@ -620,6 +620,50 @@ will run out of space between 1 and 2 million entries. You should set the .entries(..) and .entrySize(..) to those you require. +##### Don't forget to se the EntrySize + +If you put() and entry that is much larger than the max entry size set via entrySize();, see example below + +```java + ChronicleMap map = + ChronicleMapBuilder.of(Integer.class, String.class) + .entrySize(10).create(); + +``` + +it could error : + +this code will produce a java.lang.IllegalArgumentException + +```java +@Test +public void test() throws IOException, InterruptedException { + ChronicleMap map = + ChronicleMapBuilder.of(Integer.class, String.class) + .entrySize(10).create(); + + String value = new String(new char[2000]); + map.put(1, value); + + Assert.assertEquals(value, map.get(1)); +} + +``` + +and this will cause a malloc_error_break +```java +@Test +public void test() throws IOException, InterruptedException { + ChronicleMap map = + ChronicleMapBuilder.of(Integer.class, String.class) + .entrySize(10).create(); + + String value = new String(new char[20000000]); + map.put(1, value); + + Assert.assertEquals(value, map.get(1)); +} +``` # Example : Simple Hello World @@ -634,6 +678,9 @@ System.out.println(map.get(1)); ``` + + + # Example : Sharing the map on two ( or more ) processes on the same machine Lets assume that we had two server, lets call them server1 and server2, if we wished to share a map