Neo4j doesn't release memory

This is a Java thing, not a Neo4j thing.

You're using OS tools to check free memory, which don't have any insight into Java internals like JVM heap size or GC. Most GCs won't report back to the OS when they've freed up memory - once it's been commited to the heap, it won't be released/Java won't shrink the heap, even if it's free.

Starting with jdk12, this feature is being added to certain GCs (Shenandoah, G1), so it's still GC dependent, but at least possible...

You can use gds.alpha.systemMonitor() to get a better perspective on resource availability & utilization.

3 Likes