[comp.sys.amiga.programmer] COMMAND TO FIND OUT FREE MEMORY AVAILABLE ON SAS C????

goldberg@rodan.acs.syr.edu (Ross Goldberg) (01/26/91)

Is there a relatively simple procedure or command to return in bytes
the amount of free memory(including chip and expansion)(basically something
that returns the same number we see for free memory on the workbench screen.)

if so, could you provide me with how to do that?  This is needed for a 
program I am doing on SAS C so if the person has less than 10,000 bytes left,
I can tell the user as such.

thanx,
Ross Goldberg

jap@convex.cl.msu.edu (Joe Porkka) (01/26/91)

goldberg@rodan.acs.syr.edu (Ross Goldberg) writes:

>Is there a relatively simple procedure or command to return in bytes

I dunno if there is a specifiy SAS way to do it, but... RTFM

AvailMem( memory type) is a handy Exec.library function.

bytes = AvailMem(MEMF_CHIP)   Number of FAST mem bytes free
bytes = AvailMem(MEMF_FAST)   Number of FAST mem bytes free
bytes = AvailMem(MEMF_CLEAR)  Number of zero bytes free
bytes = AvailMem(0)           Total Number of bytes free

ahh@glyph.kingston.ny.us (Andy Heffernan) (01/27/91)

In article <1991Jan25.161423.26901@rodan.acs.syr.edu> goldberg@rodan.acs.syr.edu (Ross Goldberg) writes:
>Is there a relatively simple procedure or command to return in bytes
>the amount of free memory(including chip and expansion)(basically something
>that returns the same number we see for free memory on the workbench screen.)

How about the Exec function AvailMem()?

-- 
-------------------------------------------------------------------------
  Andy Heffernan		$BJ8;z(J		uunet!glyph!ahh

Jay@deepthot.UUCP (Jay Denebeim) (01/30/91)

In article <1991Jan26.051115.12062@msuinfo.cl.msu.edu> jap@convex.cl.msu.edu (Joe Porkka) writes:
>goldberg@rodan.acs.syr.edu (Ross Goldberg) writes:
>
>>Is there a relatively simple procedure or command to return in bytes
>
>bytes = AvailMem(MEMF_CHIP)   Number of FAST mem bytes free
>bytes = AvailMem(MEMF_FAST)   Number of FAST mem bytes free
>bytes = AvailMem(MEMF_CLEAR)  Number of zero bytes free
>bytes = AvailMem(0)           Total Number of bytes free

Missed one:

bytes = AvailMem(MEMF_LARGEST)  Largest free block. (this is the
                                 largest segment you can actually
                                 allocate)

--

 |_o_o|\\
 |. o.| || The           Jay Denebeim
 | .  | ||  Software
 | o  | ||   Distillery
 |    |//                         Address: mcnc!wolves!deepthot
 ======          BBS:(919)-460-7430      VOICE:(919)-460-6934

estdwha@warwick.ac.uk (CrisP) (02/03/91)

In article <Jay.8754@deepthot.UUCP> Jay@deepthot.UUCP (Jay Denebeim) writes:
>In article <1991Jan26.051115.12062@msuinfo.cl.msu.edu> jap@convex.cl.msu.edu (Joe Porkka) writes:
>>goldberg@rodan.acs.syr.edu (Ross Goldberg) writes:
>>
>>>Is there a relatively simple procedure or command to return in bytes
>>
>>bytes = AvailMem(MEMF_CHIP)   Number of FAST mem bytes free
                                          ^^^^
I think that was suppost to be CHIP.

>>bytes = AvailMem(MEMF_FAST)   Number of FAST mem bytes free
>>bytes = AvailMem(MEMF_CLEAR)  Number of zero bytes free
>>bytes = AvailMem(0)           Total Number of bytes free
>
>Missed one:
>
>bytes = AvailMem(MEMF_LARGEST)  Largest free block. (this is the
>                                 largest segment you can actually
>                                 allocate)
>

You can also combine them:

bytes = AvailMem(MEMF_CHIP | MEMF_LARGEST) Largest free block of CHIP memory.
bytes = AvailMem(MEMF_FAST | MEMF_LARGEST) Largest free block of FAST memory.

You can also combine tme all with the uninplemented MEMF_PUBLIC.

One thing I always wondered about is what does AvailMem(MEMF_CLEAR) mean?

~CrisP.
--
-------------------------------------------------
crisp@uk.ac.warwick.cs | estdwha@uk.ac.warwick.cu
-------------------------------------------------

daglem@idt.unit.no (Dag Lem) (02/04/91)

In article <1991Feb3.043150.2452@warwick.ac.uk>, estdwha@warwick.ac.uk (CrisP) writes:

|> One thing I always wondered about is what does AvailMem(MEMF_CLEAR) mean?

Probably the same as AvailMem(0).
I believe MEMF_CLEAR is for use with AllocMem only (fills allocated memory
with zeroes).
Also, MEMF_LARGEST gives no meaning to AllocMem, just to AvailMem.

|> ~CrisP.
|> --
|> -------------------------------------------------
|> crisp@uk.ac.warwick.cs | estdwha@uk.ac.warwick.cu
|> -------------------------------------------------

-- 
    __                /                       |> Shorter of breath
   /  \  __   __     /   ___  _ _             |> and one day closer to death.
  /    |/  / /  /   /   /__/ / / /            |>   -Roger Waters, Time 
 /____/ \_/|/\_/   /____\___/ /  \__________  |>    (Dark Side of The Moon) 
______________/