Replies: 3 comments 3 replies
-
|
Hello, please see lazy / eager storing for details. |
Beta Was this translation helpful? Give feedback.
-
|
Hello @hg-ms,
creates 1'400'000
The So I really wonder, what I'm doing wrong when clearing the Map. In addition, I wonder how to store an even larger amount of objects without hitting a memory limit. In my real application, I've got enough memory to hold all |
Beta Was this translation helpful? Give feedback.
-
|
Many thanks for your sample. With that sample I can explain why you still see that For some more details please see Housekeeping If low on memory the only option is to avoid persisting that much object instances. This may be quite tricky. One thing might be to use primitive arrays instead of object-based collections or to implement specialized handlers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing a small application (based on MicroStream 07.01.00-MS-GA) that uses a
Map<Long, Foo>as root (wrapped in a simpleDataRootclass). After storing about 700Fooinstances (which of course reference other custom instances and JDK instances), I took a memory snapshot and analyzed it with YourKit profiler.Much to my surprise, the snapshot contained about 18 million (strongly reachable) instances of
StorageEntity$Default(corresponding to 97% of the total number of instances in the JVM) and a shallow size of about 1.2GB (corresponding to 86% of the total heap).The
Fooclass has aListfield that can grow quite large and which I thus made Lazy:private Lazy<List<Record>> records;Right after storing a
Fooinstance I callfoo.records.clear()and I consequently don't see any instances ofRecordin the heap dump:If I however remove the
recordsfield, the problem goes away. So I suspect theStorageEntity$Defaultinstances have something to do with this field.Here is the shortest path of one random instance to a GC root:
What is also strange: if I programatically clear and save the data root
Mapand take another snapshot, theFooinstances are gone as expected, but theStorageEntity$Defaultinstances are still there, even after restarting the application.As I'm not very experienced with MicroStream, I suppose I did something wrong. Could you please enlighten me?
Beta Was this translation helpful? Give feedback.
All reactions