Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 1998 14:14:38 -0500 (EST)
From:      Alfred Perlstein <bright@hotjobs.com>
To:        Thomas Dean <tomdean@ix.netcom.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: Physical Memory Allocation
Message-ID:  <Pine.BSF.3.96.980630140745.475F-100000@bright.ny.otec.com>
In-Reply-To: <199806301705.KAA00358@ix.netcom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The kernel has some data structures that can be extended but NOT released,
specifically mbufs and probably certain data pertaining to page tables and
such. which might explain the shift into Wired state.

you can also see how the vm/buffer system has started to cache more
objects, the increase in size of the buffers impacts on the amount of
memory available elsewhere.

netscape hits a lot more "things" than a simple memory allocation program
causing a switch in the strategies used by the kernel.

the change in "Active" pages is odd though...

are you running NFS or some client/server process on the machine as well?

-Alfred

On Tue, 30 Jun 1998, Thomas Dean wrote:

> This may not be a question for -current, but, it pertains to memory
> allocation.  I don't know if this happens on a non-current system.
> 
> I do not understand the shift of memory allocation between the various
> categories used by top. Running a process which handles memory
> properly should have little effect on memory allocation after it
> exits.  If I start netscape 3.01 and exit, there seems to be a
> permanent shift of memory allocation from free to active and wired.
> This does not happen with a process that allocates and then frees
> memory.
> 
> I have attached information picked from top while these events
> transpired and the code I used to allocate/free memory.
> 
> What is the definition of the memory allocation numbers in top?
> 
> I am running -current:
> 
> FreeBSD 3.0-CURRENT #0: Fri Jun 19 09:15:17 PDT 1998
>     root@celebris:/usr/src/sys/compile/CELEBRIS-SMP
> Timecounter "i8254"  frequency 1193182 Hz  cost 2537 ns
> CPU: Pentium/P54C (586-class CPU)
>   Origin = "GenuineIntel"  Id = 0x525  Stepping=5
>   Features=0x3bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,APIC>
> real memory  = 100663296 (98304K bytes)
> avail memory = 95272960 (93040K bytes)
> FreeBSD/SMP: Multiprocessor motherboard
>  cpu0 (BSP): apic id:  0, version: 0x00030010, at 0xfee00000
>  cpu1 (AP):  apic id:  1, version: 0x00030010, at 0xfee00000
>  io0 (APIC): apic id:  2, version: 0x000f0011, at 0xfec00000
> 
> ============================================================
> 
> Use top to get memory use values.
> After boot, running Emacs, reading mail, edit this text file.
> Mem: 13M Active, 6200K Inact, 8500K Wired, 508K Cache, 3989K Buf, 65M Free
> 
> Start Netscape.
> Mem: 17M Active, 7992K Inact, 9232K Wired, 808K Cache, 4621K Buf, 58M Free
> Access a file with Netscape.
> Mem: 19M Active, 8044K Inact, 9444K Wired, 760K Cache, 4813K Buf, 56M Free
> Exit Netscape.
> Mem: 15M Active, 8060K Inact, 10M Wired, 728K Cache, 5469K Buf, 59M Free
> 
> Start Netscape and access a file.
> Mem: 20M Active, 8296K Inact, 10M Wired, 504K Cache, 5469K Buf, 54M Free
> Exit Netscape.
> Mem: 16M Active, 8296K Inact, 10M Wired, 504K Cache, 5469K Buf, 59M Free
> 
> Start Netscape and access a file.
> Mem: 19M Active, 8300K Inact, 10M Wired, 504K Cache, 5469K Buf, 55M Free
> Access the Alta Vista search page.
> Mem: 19M Active, 8336K Inact, 10M Wired, 552K Cache, 5610K Buf, 55M Free
> Exit Netscape.
> Mem: 16M Active, 8380K Inact, 10M Wired, 552K Cache, 5588K Buf, 58M Free
> 
> 
> Start memoryTest.c, allocate 2 each 10MB blocks and write to them.
> Mem: 36M Active, 8364K Inact, 10M Wired, 540K Cache, 5759K Buf, 38M Free
> After memoryTest.c exits.
> Mem: 16M Active, 8360K Inact, 10M Wired, 536K Cache, 5759K Buf, 58M Free
> 
> Start memoryTest.c, allocate 2 each 10MB blocks and write to them.
> Mem: 36M Active, 8372K Inact, 10M Wired, 536K Cache, 5759K Buf, 38M Free
> After memoryTest.c exits.
> Mem: 16M Active, 8360K Inact, 10M Wired, 536K Cache, 5759K Buf, 58M Free
> 
> Start memoryTest.c, allocate 2 each 10MB blocks and write to them.
> Mem: 36M Active, 8388K Inact, 10M Wired, 536K Cache, 5760K Buf, 38M Free
> After memoryTest.c exits.
> Mem: 16M Active, 8376K Inact, 10M Wired, 536K Cache, 5760K Buf, 58M Free
> 
> ============================================================
> 
> /*
>   memTest.c - Just use some memory.
> 
>   calloc memory and write into it.
> 
>   Syntax: memTest <max MB>
> 
>   */
> 
> #include <stdio.h>
> #include <stdlib.h>
> 
> #define ONE_MB 1024*1024
> 
> main(int argc, char **argv) {
>   unsigned int testSize, jdx;
>   unsigned char *buf1, *buf2;
> 
>   if (argc != 2) {
> 	printf("Usage: %s <max MB>\n",argv[0]);
> 	exit(0);
>   }
> 
>   if (sscanf(argv[1], "%u", &testSize) != 1) {
> 	printf("Error in argument: %s\n",argv[0]);
> 	exit(0);
>   }
> 
>   printf("allocatinging %uMB\n",testSize);
>   buf1 = (unsigned char *)calloc(1, testSize*ONE_MB);
>   if (!buf1) {
> 	perror("calloc1");
> 	exit(0);
>   }
>   buf2 = (unsigned char *)calloc(1, testSize*ONE_MB);
>   if (!buf2) {
> 	perror("calloc2");
> 	exit(0);
>   }
>   printf("Testing %uMB at %08x and %08x = %u\n",
> 		 testSize, buf1, buf2, (unsigned int)(buf2-buf1));
>   for (jdx=0; jdx<testSize*ONE_MB; jdx++) buf1[jdx] = 0xff;
>   for (jdx=0; jdx<testSize*ONE_MB; jdx++) buf2[jdx] = 0xff;
>   free(buf1);
>   free(buf2);
> }
> 	
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message
> 


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980630140745.475F-100000>