Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Sep 1999 02:04:22 -0700 (PDT)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Kevin Day <toasty@dragondata.com>
Cc:        dcs@newsguy.com (Daniel C. Sobral), toasty@dragondata.com (Kevin Day), hackers@FreeBSD.ORG
Subject:   Re: Idea: disposable memory
Message-ID:  <199909230904.CAA23644@apollo.backplane.com>
References:   <199909230624.BAA94111@celery.dragondata.com>

next in thread | previous in thread | raw e-mail | index | archive | help

:> > Thoughts?
:> 
:> man madvise?
:> 
:
:Yeah, but MADV_FREE doesn't really do what I need. I have no idea if the
:system actually did free my ram or not. I want to hang on to the data, but
:if more ram is needed, then it can be discarded, but I need to know that it
:did, so that I can recreate it. Checking every time I blit an object to see
:if the page is zero'ed won't work.
:
:Kevin

    madvise ... MADV_DONTNEED is what you want.  The data will remain mapped
    until the system reuses it, at which point it reverts to zero-fill.

    The system will reuse the data fairly quickly, even if the system is
    not all that loaded.

    You can lock the page back in simply by writing to something in the page.

    The system implements this madvise feature by marking the pages clean.
    If you happen to write to the page before the system reuses it, it of
    course gets redirtied.  If you don't and the system reuses the page,
    it goes bye bye (turns into zero-fill) from the point of view of your
    process.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>



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




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