mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
added readme - ##### Don't forget to se the EntrySize
This commit is contained in:
@@ -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<Integer, String> 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<Integer, String> 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<Integer, String> 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
|
||||
|
||||
Reference in New Issue
Block a user