Live data from Hacker News

FreeBSD ate my RAM

crocidb.com

31–40 of 89 posts

Re: FreeBSD ate my RAM

#31
I don’t understand the part about using heuristics and deciding what counts as used memory…

Used memory for the system is always total minus available.

Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?

Re: FreeBSD ate my RAM

#32

If you like this kind of post, you might like this “htop explained” post. https://peteris.rocks/blog/htop/

htop explained* I was looking forward for web protocol, but alas...

It was a typo. Thanks, fixed.

But there is an http headers article you might like.

https://peteris.rocks/blog/exotic-http-headers/

Re: FreeBSD ate my RAM

#33

I don’t understand the part about using heuristics and deciding what counts as used memory… Used memory for the system is always total minus available. Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?

The thing is it's easy to define free, unused memory. But a lot of the used memory is your system caching stuff that would be free if you needed more than what's actually free. So you can see you have 1g of free memory out of your 4g, but then you allocate 3g and it will do without a sweat and you'd be confused. So you have to go and dig for what those caches are and report that they're effectively free too.

Re: FreeBSD ate my RAM

#34

I don’t understand the part about using heuristics and deciding what counts as used memory… Used memory for the system is always total minus available. Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?

You will be surprised by how inaccurate memory measurements are.

Re: FreeBSD ate my RAM

#35

I don’t understand the part about using heuristics and deciding what counts as used memory… Used memory for the system is always total minus available. Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?

> I would hope that the system knows precisely what is using every single byte of physical and virtual memory.

Of course the system knows what is using every page. The difficulty is really in how to account for pages that are backed by disk.

If you count all of those as free, that's not accurate. If you count all of those as used, that's not accurate either. Additionally, FreeBSD (at least) doesn't have separate queues for disk backed pages, so there's not really a good way to know how much of your active (or inactive) memory is disk backed.

As an additional caveat that measuring active/inactive has costs. In the past, FreeBSD wouldn't really do the work for that until it needed to... I know some stuff changed, but I don't remember where it ended up; it wasn't great when it bulk marked a ton of pages as inactive and then the active ones would fault back in.

Re: FreeBSD ate my RAM

#37
post #33

I don’t understand the part about using heuristics and deciding what counts as used memory… Used memory for the system is always total minus available. Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?

The thing is it's easy to define free, unused memory. But a lot of the used memory is your system caching stuff that would be free if you needed more than what's actually free. So you can see you have 1g of free memory out of your 4g, but then you allocate 3g and it will do without a sweat and you'd be confused. So you have to go and dig for what those caches are and report that they're effectively free too.

Instantly reclaimable disk caches should count as available, and they do.

This isn’t hard. The OS should just expose a counter for available memory instead of having applications understand every type of memory reservation.

edit:

Linux does this, but it has its own share of issues with memory counters. The “cached” memory includes tmpfs and ramfs for seemingly no reason.

Re: FreeBSD ate my RAM

#38
post #35

I don’t understand the part about using heuristics and deciding what counts as used memory… Used memory for the system is always total minus available. Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?

> I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Of course the system knows what is using every page. The difficulty is really in how to account for pages that are backed by disk. If you count all of those as free, that's not accurate. If you count all of those as used, that's not accurate either. Additionally, FreeBSD (at least) doesn't have separate queu…

> If you count all of those as free, that’s not accurate.

Why not? It depends on what you’re measuring. Physical memory? They count as free. Virtual memory? They count as used.

The ambiguities only arise when we stop making that distinction very clear.

Re: FreeBSD ate my RAM

#39
post #33

Earlier quoted context omitted.

The thing is it's easy to define free, unused memory. But a lot of the used memory is your system caching stuff that would be free if you needed more than what's actually free. So you can see you have 1g of free memory out of your 4g, but then you allocate 3g and it will do without a sweat and you'd be confused. So you have to go and dig for what those caches are and report that they're effectively free too.

Instantly reclaimable disk caches should count as available, and they do. This isn’t hard. The OS should just expose a counter for available memory instead of having applications understand every type of memory reservation. edit: Linux does this, but it has its own share of issues with memory counters. The “cached” memory includes tmpfs and ramfs for seemingly no reason.

> The “cached” memory includes tmpfs and ramfs for seemingly no reason.

If you're curious why that is by the way, it's because that's actually how these are implemented (tmpfs/ramfs is just a mount to a filesystem where the files never get marked clean[1])

[1]: https://www.kernel.org/doc/Documentation/filesystems/ramfs-r...

Re: FreeBSD ate my RAM

#40

Earlier quoted context omitted.

I remember how NetBSD promoted itself as running on many more toasters than Linux once. Then some NetBSD dev wrote on their mailing list that this is no longer true. Linux runs on more toasters now. (And also top 500 supercomputers, but toasters are the real metal to the petal test.) These fights always remind me of: https://www.jwz.org/doc/worse-is-better.html It's an interesting piece of history too. I kind of eval…

why did that url point me to a scrotum in an egg cup

HN has disappointed JWZ
Post reply on HN