Check Memory Usage, program like 'free' in Linux

Jon Schipp jonschipp at gmail.com
Thu Nov 3 16:22:22 UTC 2011


On Thu, Nov 3, 2011 at 11:55 AM, Lowell Gilbert <
freebsd-questions-local at be-well.ilk.org> wrote:

> Jon Schipp <jonschipp at gmail.com> writes:
>
> > On Thu, Nov 3, 2011 at 9:25 AM, Rares Aioanei <bsdlisten at gmail.com>
> wrote:
> >
> >> On 11/03/2011 03:18 PM, Jon Schipp wrote:
> >>
> >>> Is there a program to check physical memory usage in FreeBSD(using 8.2
> >>> RELEASE)?
> >>> In vain of 'free' in Linux.
> >>>
> >>> I know you can check the values with sysctl, I was just checking if
> anyone
> >>> has a "cleaner" option.
> >>> I was always curious.
> >>>
> >>> Thanks
> >>> Jon
> >>> ______________________________**_________________
> >>> freebsd-questions at freebsd.org mailing list
> >>> http://lists.freebsd.org/**mailman/listinfo/freebsd-**questions<
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions>
> >>> To unsubscribe, send any mail to "freebsd-questions-**
> >>> unsubscribe at freebsd.org <freebsd-questions-unsubscribe at freebsd.org>"
> >>>
> >>>  top?
> >>
> >
> > Crap, I forgot mention that it needs to be non-interactive, it will be
> for
> > e-mail alerts.
> >
> > So that rules out top as for as I know.
>
> No, you could script it out of top(1), but I'm going to guess that
> you're trying to be warned when the system is close to running out of
> memory.  That is silly -- you paid for the memory; why would you *want*
> it to sit around doing nothing?
>

While this isn't my intention...

I'm curious:

You wouldn't want to know when your machine has reached periods of high
memory utilization?
Occurrence/frequency information seems pretty valuable.
More importantly, at specific times, noticing patterns, use during/after
business hours
If you didn't want to use memory, it wouldn't be purchased. I don't think
keeping track of the utility of
your purchases is silly.

Also note that the definition of "free" is somewhat complicated.
>
> Maybe if you described the actual problem you want to solve, we could
> suggest a more appropriate answer.
>
> A literal answer to your question might be:
>  top -d 1|grep '^Mem:'|cut -d ',' -f 6
> assuming the format of the line of top doesn't change.
>

That does the trick. I didn't think it was possible to grab data from
interactive programs without throwing in some "garbage".
Should've tested.
Thanks


More information about the freebsd-questions mailing list