Namespace Memory gets freed up after Aerospike restart

I have around 3 mn records in my aerospike cache. My persistence is disk-based and I have allotted certain memory to it as well. On my different sets, I have several Secondary Indexes created which are contributing to the memory of the namespace. I have around 20 lakh expired objects and 10 mn evicted objects.

On server restart, my memory gets freed up.

My question is as the expired and evicted objects are stored in disk and are cleared from the disk on a cold start, are the indexes of these objects stored on RAM?

If yes, is there any other solution to clear those from RAM automatically?

The primary index should be freed up when you get the evictions / expirations. The secondary index garbage collection happens at a pre-determined interval governed by https://www.aerospike.com/docs/reference/configuration/index.html#sindex-gc-period

if you’re seeing the memory consumed by the secondary, rather than primary index you may be running into the behaviour we document here: