Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2001 16:45:17 -0600
From:      Mike Meyer <mwm@mired.org>
To:        jritchie@panasas.com
Cc:        questions@freebsd.org
Subject:   Re: Need to be able to determine amount of memory in system and turn  off virtual memory...
Message-ID:  <15328.32509.131773.670449@guru.mired.org>
In-Reply-To: <45246398@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
jritchie@panasas.com types:
> Hello,
> 	I am writing a program to test memory on FreeBSD, and have some
> questions.  I use sysctl to show me the amount of hw.physmem in the system,
> and I am able to allocate through malloc more than the value given by
> hw.physmem.  In addition I commented out the swap device in the /etc/fstab
> to turn off virtual memory, yet what I can allocate through malloc is the
> same either way.  The question is:
> 	1.) how do I determine reliably the amount of memory in the system

hw.physmemseems to do that.

> 	2.) and how do I turn off virtual memory?

You can't. You can turn of paging and swapping, which you did by
disabling swap.

> Any hints, suggestions, code snipets will be greatly appreciated!

Suggestion: assume the system is smart. It doesn't allocate a page
until you actually *need* to allocate it. This includes things like
creating pages full of zeros when you read and/or write a page for the
first time, and creating a copy of a page only when one of the people
using it changes it.

Check memtest in the ports tree to see how they do these things. Maybe
it already does what you want.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Q: How do you make the gods laugh?		A: Tell them your plans.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15328.32509.131773.670449>