Sam Dave wrote:
While I write to an LMDB database, while it gets bigger and bigger, I can see %MEM in top rising steadily.
This is because %MEM is composed of three things, including "RSfd". From the top manpage:
RSfd -- Resident File-Backed Memory Size (KiB) A subset of resident memory (RES) representing the implicitly shared pages supporting program images and shared libraries. It also includes explicit file mappings, both private and shared.
Is it memory mapping that's resulting in the higher RSfd?
LMDB uses shared memory mapped files, so yes.
RSfd increases do not seem to have an effect on "buff/cache" or "avail Mem", i.e. what most people think as "RAM" is not being used up. I still want to ask, could too high RSfd use result in less efficient use of memory for other programs? I'm essentially wondering how efficient common OSes (e.g. MacOS, Linux) are in this area.
No. The OS can reclaim LMDB's pages (at zero cost) for use by any other program whenever memory demands are tight.
- Sam