From owner-freebsd-current Tue Jun 30 10:05:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA23164 for freebsd-current-outgoing; Tue, 30 Jun 1998 10:05:20 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from ix.netcom.com (sil-wa4-47.ix.netcom.com [207.93.136.111]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA23154 for ; Tue, 30 Jun 1998 10:05:12 -0700 (PDT) (envelope-from tomdean@ix.netcom.com) Received: (from tomdean@localhost) by ix.netcom.com (8.8.8/8.8.8) id KAA00358; Tue, 30 Jun 1998 10:05:08 -0700 (PDT) (envelope-from tomdean) Date: Tue, 30 Jun 1998 10:05:08 -0700 (PDT) Message-Id: <199806301705.KAA00358@ix.netcom.com> From: Thomas Dean To: current@FreeBSD.ORG Subject: Physical Memory Allocation Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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 */ #include #include #define ONE_MB 1024*1024 main(int argc, char **argv) { unsigned int testSize, jdx; unsigned char *buf1, *buf2; if (argc != 2) { printf("Usage: %s \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