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
Chronicle Map Versions I used - 3.22ea6 / 3.22ea5 / 3.21.86
I am trying to delete few unnecessary entries and add new entries. But the Chronicle Map throws Exception even before the configured Max Entries limit reaches.
Shown below a sample code.
ChronicleMap<ByteBuffer, ByteBuffer> main = ChronicleMapBuilder.of(ByteBuffer.class, ByteBuffer.class)
.name("main")
.entries(61500)
.averageKey(ByteBuffer.wrap(new byte[500]))
.averageValue(ByteBuffer.wrap(new byte[5120]))
.create();
SecureRandom random = new SecureRandom();
int failureCount = 0;
while (true)
{
System.out.println();
System.out.println("--------------------------\nMain Heap Size -> " + main.offHeapMemoryUsed());
System.out.println();
try
{
int mainEntries = main.size();
while /* (true) Loop until error is thrown */ (mainEntries < 61500)
{
try
{
byte[] keyN = new byte[500];
byte[] valueN = new byte[5120];
random.nextBytes(keyN);
random.nextBytes(valueN);
main.put(ByteBuffer.wrap(keyN), ByteBuffer.wrap(valueN));
mainEntries++;
}
catch (Throwable t)
{
System.out.println(">>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<");
failureCount++;
break;
}
}
System.out.println("Main Entries -> " + main.size());
if(failureCount >= 10)
{
System.out.println();
System.out.println("--------------------------\nTerminating the Program");
break;
}
AtomicInteger entriesRemoved = new AtomicInteger(0);
main.forEachEntry(c -> {
if (entriesRemoved.get() < 7000)
{
c.context().remove(c);
entriesRemoved.incrementAndGet();
}
});
System.out.println("Removed " + entriesRemoved.get() + " Entries from Main");
}
catch (Throwable t)
{
break;
}
}
main.close();
The above code yields the following result.
Added a Summary of the Result. Please see the drop-down for the full Result If needed
Main Heap Size -> 398061568
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 43858
Removed 7000 Entries from Main
Main Heap Size -> 398061568
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 398061568
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 447817984
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
Main Entries -> 61500
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 746356480
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 58362
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 51578
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 44611
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 38000
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 31039
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 24040
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 17071
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 10092
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 43858
Removed 7000 Entries from Main
--------------------------
Main Heap Size -> 796112896
>>>>>>>>>> !!! Max Entries is not yet reached !!! <<<<<<<<<<
Main Entries -> 36874
--------------------------
Terminating the Program
In the above result in the drop-down, We can see that the Max Entries of the Map got decreased in the subsequent iterations
In the Issue 128, it was said the entries are deleted properly. Then why the above behavior happens?
Is it an issue? or Is the Chronicle Map not designed for such usage pattern?
Chronicle Map Versions I used - 3.22ea6 / 3.22ea5 / 3.21.86
I am trying to delete few unnecessary entries and add new entries. But the Chronicle Map throws Exception even before the configured Max Entries limit reaches.
Shown below a sample code.
The above code yields the following result.
Added a Summary of the Result. Please see the drop-down for the full Result If needed
In the above result in the drop-down, We can see that the Max Entries of the Map got decreased in the subsequent iterations
In the Issue 128, it was said the entries are deleted properly. Then why the above behavior happens?
Is it an issue? or Is the Chronicle Map not designed for such usage pattern?
Please Refer my question in Stackoverflow also.
The text was updated successfully, but these errors were encountered: