Free mem function wanted in SOLARIS

Free mem function wanted in SOLARIS

Post by Joe Ellio » Wed, 12 Jun 1996 04:00:00



Im looking for a way in SOLARIS to programmitacally thro a C function get
the available free physical memory. I can do this currently on SGI
machines.

I want the total physical memory
The amount of memory allocated
The amount of free memory
This should be distinguishable from SWAP space.

Kind of like bloatview on IRIX

If anyone has a code fragment to do this it would be greatluy appreciated.

Thanx in advance .. Joe.
--
                                          __o       _~o       __o
                                         `\<,      `\<,      `\<,
_______________________________________(*)/_(*)__(*)/_(*)__(*)/_(*)________
_
 Im a 21st Century Digital Boy ... I aint got a life, but I got lotsa
toys.
Its not that lifes too short, its that you're dead for so long. Just Do
It!

 
 
 

Free mem function wanted in SOLARIS

Post by Bryan Helv » Fri, 14 Jun 1996 04:00:00


I tried the netstat -k, and it does indeed work, but I have 1 question. Why
isn't this in the Sol2.5 man page?

---

Systems Administrator           Amoco Corp.
(713) 366-3993              ITSS Division
/*Clowns to the left of me, jokers to the right, here I am...*/

 
 
 

Free mem function wanted in SOLARIS

Post by Joerg Schilli » Sat, 15 Jun 1996 04:00:00


Are you working on HP-UX ?

On Solaris you should use sysconf(_SC_PAGESIZE) instead of sysconf(_SC_PAGE_SIZE)

Joerg

BTW. Both Sun & HP state their name to be POSIX compliant....




>>Im looking for a way in SOLARIS to programmitacally thro a C function get
>>the available free physical memory. I can do this currently on SGI
>>machines.
.....
>>I want the total physical memory
>physmem (pages)
>>The amount of memory allocated
>physmem - freemem   I suppose
>>The amount of free memory
>freemem (pages)

>sysconf(_SC_PAGE_SIZE) gets you the page size - 4KB (most systems) or 8KB (ultras)

 
 
 

1. help: free list of vmstat does free up when shared mem removed

Adam,


Memory is indeed not necessarily added back to the free list until demanded.
You are probably using a lot of memory with the PowerMart app, and since
memory usage is high, it is immediately placed back in the free list.
Either
that, or the memory management algorithm places large chunks of memory
back into the free list immediately, but waits for a demand for small
chunks.

The ipcrm probably isn't freeing memory at a time when that memory is
needed.  Therefore, the memory manager isn't going to waste CPU
cycles adding it back to the free list.  I suspect that if the amount of
memory is enough, the memory manager will place it all back in the
free list, but I certainly am not privy to the details of the memory
management algorithms.

Blocks shown in the "free" column of vmstat and in the "SZ" column of
ps -elf are 8k.  Here's a tip- look over ps -elf.  Watch out for the desktop
processes, which include the size of the memory in use on the graphics
card and therefore appear huge.  See Sunsolve for an explanation of this...

Look over sar and the Virtual Adrian utilities.

Good luck!
-B^2
;)

2. HELP !!! 1.3.57 kernel hangs after mounting root readonly

3. Wanted - plain ascii table of Solaris 1.x to Solaris 2.x function mapping

4. mandrake 9 won't install Belkin F5D5000 (realtek 8139) NIC

5. Solaris 2.4 panic: free: freeing free block

6. Limitations of Linux?

7. WANTED: Reward for NExS Spreadsheet Plug-Ins

8. Western Digital WD7193 SCSI adapter support for Linux?

9. exchange free solaris 7 against free solaris 6

10. WANTED: Free UNIX account with > 1MB free space

11. solaris wanted -free,warez or inexpensive?

12. Wanted: Free POP3 server on Solaris x86

13. solaris wanted -free or inexpensive?