Re: Available memory

From: Allo (other_at_st.uff)
Date: 02/29/04


Date: Sat, 28 Feb 2004 18:06:41 -0500

In article <hR80c.113749$hR.2200197@bgtnsc05-news.ops.worldnet.att.net>,
hukolau@NOSPAM.att.net says...
>
>
> Allo wrote:
>
> > Is there a function call, or a set of calls, that will tell me how much=
> =20
> > physical memory is available to grab with malloc?
> >=20
> > I'm sure there is, but I can't find it.
>
> see if there's an getrlimit(2) function in your
> distribution.
>
> man 2 getrlimit
>
> It's a Berkleyism as far as I can tell but may
> be in some other kernels as well.

Yeah, there is. (I'm using Solaris, by the way.)

And it just occurred to me that I could always look at the source code
for "top" and see how that prog checks for quantities of available
memory. Should've thought of that sooner.



Relevant Pages

  • Re: Available memory
    ... Jerry Feldman writes: ... And anyway, you don't grab physical memory, you grab virtual memory: ... the OS can swap your process out anytime. ...
    (comp.unix.programmer)
  • Re: Available memory
    ... Allo wrote: ... > physical memory is available to grab with malloc? ...
    (comp.unix.programmer)
  • Re: Available memory
    ... >physical memory is available to grab with malloc? ... why would you want to do that -- just allocate what you need. ...
    (comp.unix.programmer)
  • Re: Darwin malloc()-ing a few large blocks vs. many many small blocks
    ... >> Once you have used up all physical memory your machine will start ... including per-process and per-user limits that ... > can be set substantially lower than the maximal theoretical VM size. ... > A process may run out of malloc() when there is no thrashing going ...
    (comp.sys.mac.programmer.help)
  • Re: Anyone know how to access the Link between Page File & Physical Memory?
    ... > I went through debuging a call to malloc() to try to find out where the link ... between virtual memory and physical memory is stored, ...
    (microsoft.public.development.device.drivers)