Memory usage

Is it normal to use 1030MiB just upon boot?
Hrev52830, x86_64, dual Xeon 8 cores total 2.5ghz, 32767MiB total ecc RDIMMs.

For 32GB of RAM? Probably, yes. The kernel needs a ~70 byte VMPage structure for every 4K (4096 bytes) page. Thus 2% of your memory (around 650MB or so, in this case) will be dedicated to paging structures. We could probably mitigate this by using 64K pages instead; though how much work it would be to enable these, I have no idea. It could be anything from a few days to a few months…

Of the remaining 400MB, probably 200-300MB are used by packagefs, and the rest by the actual system. We really need to optimize packagefs for memory usage, too.

4 Likes

I’m not complaining in the slightest. Just surprised by this observation. I’ve never had access to this much RAM before. I also perhaps found a memory leak? My uptime is 46 minutes on the machine, and all I’ve done is boot. Memory usage is up 9 MB since boot. I’m posting from another machine. I’m going to let it idle for awhile and see what it does.

3 hours uptime. 47MiB more than at boot. Haven’t ran anything.

Allocating this data structure for each page of physical RAM up front is a weird choice. Is this actually how Haiku works?

Um … yes.

I don’t know why you say it’s a “weird choice”? In order to work with the physical pages, we need a tracking structure for each one, to mark whether it is in use, free, reserved, etc. So if we did not allocate it “up front”, we would need to allocate it in order to use the physical page. Either way, you can’t use a page without it, so it’s used space either way; and allocating the structure up front means we can map and index it in certain ways.

I’m pretty sure that’s how FreeBSD and Linux operate, too (though I’m no expert here.) Linux at least uses 64K pages on systems with a lot of RAM instead of 4K pages, so it will use 6% as much memory (i.e. 35MB instead of 650MB, roughly) than Haiku does.

1 Like

1gb tied up out of 32gb doesn’t bother me. I would like to look into this possible memory leak though. I’m more bothered by the idea RAM usage is increasing over time at idle than by the large initial RAM usage.

2 Likes