From nobody@FreeBSD.org  Wed Aug 19 20:09:00 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C53E1065695
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 19 Aug 2009 20:09:00 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 7BA7D8FC71
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 19 Aug 2009 20:09:00 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JK8xLH020311
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 19 Aug 2009 20:08:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n7JK8xZ7020302;
	Wed, 19 Aug 2009 20:08:59 GMT
	(envelope-from nobody)
Message-Id: <200908192008.n7JK8xZ7020302@www.freebsd.org>
Date: Wed, 19 Aug 2009 20:08:59 GMT
From: Mihail Konuhov <piroman@myconfig.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Not clearing of memory after file deletion from a ram-disk
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         137975
>Category:       i386
>Synopsis:       Not clearing of memory after file deletion from a ram-disk
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-i386
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 19 20:10:01 UTC 2009
>Closed-Date:    Wed Aug 19 21:37:39 UTC 2009
>Last-Modified:  Wed Aug 19 21:37:39 UTC 2009
>Originator:     Mihail Konuhov
>Release:        FreeBSD 7.2-RELEASE
>Organization:
hidden
>Environment:
FreeBSD hosting2 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri Aug 14 23:42:05 MSD 2009     root@hosting2.localdomain:/usr/obj/usr/src/sys/myconf  i386
>Description:
Hello, all!
Excuse for my bad English...
I use ram-disks created by means of the utility "mdconfig". I have a problem with clearing of the RAM occupied with a ram-disk after removal of all files from it. At first I create ram-disk, I format in ufs it and I create on it a file on the size close to the ram-disk size. Then I delete a file both I check a memory state and I see that all memory was liberated not. Memory clearing occurs only after a ram-disk blackout.


------- other --------
system information:
make.conf:
PERL_VERSION=5.8.9
KERNCONF=myconf

myconf:
GENERIC options and devices and:

options         IPFIREWALL
options         IPFIREWALL_VERBOSE
options         IPFIREWALL_VERBOSE_LIMIT=0
options         IPFIREWALL_DEFAULT_TO_ACCEPT
options         IPDIVERT
options         IPFIREWALL_FORWARD
device          vlan



>How-To-Repeat:
This problem appears at performance of following operations:

--- Free Memory: 1934M, Free swap: 500M

# mdconfig -a -t swap -s 1024m -u 501
# newfs -m 0 -U md501
# mount /dev/md501 /home/0/run
# dd if=/dev/zero of=/home/0/run/test bs=1024 count=943718
# rm /home/0/run/test

--- Free Memory: 1003M, Free swap: 500M

# umount /home/0/run/
# mdconfig -d -u 501

--- Free Memory: 1925M, Free swap: 500M
>Fix:
I do not know solution of this problem

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Wed Aug 19 21:37:38 UTC 2009 
State-Changed-Why:  
I think this is not a problem but misunderstanding about how FreeBSD's 
memory allocation works. As you see memory is being taken and 'released' 
after use, though not entirely; why? FreeBSD also uses the memory as 
caching mechanism. For example if you issue an ``ls`` and then do the 
``ls`` again, you will see that the second time it will return much 
quicker; this is temporarily cached in memory to help you do repeated 
tasks quicker. If needed the memory is freed and used for 'more 
important' operations. On my systems I normally have 'limited' free 
memory available; I do not worry about this because I understand that 
it's the caching that 'takes' the memory and releases it when needed. 
Please ask around on the questions mailinglist if this was insufficient 
explanation. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137975 
>Unformatted:
