Yes, this is normal behavior because it does a full garbage collection before taking a snapshot. If you see that memory usage drops when you get a snapshot, this is a good sign.
The garbage collector clears the memory only when there is a memory voltage. If you want to check for memory leaks, you need to complete a complete garbage collection and get a snapshot. If something remains, it is a memory leak.
Typically, you should get a clean base snapshot, and then another clean snapshot after completing the function you want to test, and then compare both snapshots.
source share