[comp.sys.amiga.tech] Followup to Freeing memory on demand

bryan@geo-works.UUCP (Bryan Ford) (08/04/89)

Just an idea that I thought I'd toss out...

The problem with using a fake library (via the Expunge function) to free
caches is that it can't be told exactly *how much* memory needs to be
freed.  If I've got megabytes of caches, and a program needs only a few K,
I don't want to free the whole bit.  Question:  Does the memory allocator
always go through the entire library/device list before retrying the
allocation, or does it retry after each library node it calls, and stop
when it can get enough memory?  If it stops after it gets enough, it might
be possible to make the fake Expunge function free a little memory (say one
cache), remove itself from the library list, and add itself back into the
end of the list.  That way, if the memory allocator needed more memory, it
would find the library again, call it again, and the library would free
more memory.

Also, would it be good to SetFunction() the AllocMem() function?  Does the
OS always (or at least usually) allocate memory through this entry point,
or does it call itself directly?

Thanks!

				Bryan

--

     _______________________________________
   _/   Bryan Ford - bryan@geo-works.uucp   \_
 _/  ..!utah-cs!caeco!i-core!geo-works!bryan  \_
/ ..!uunet!iconsys!caeco!i-core!geo-works!bryan \
\_____________Author: Chroma Paint______________/

451061@UOTTAWA.BITNET (Valentin Pepelea) (08/07/89)

Bryan Ford <bryan@geo-works.uucp> writes in Message-ID: <2085.AA2085@geo-works>

> Also, would it be good to SetFunction() the AllocMem() function?  Does the
> OS always (or at least usually) allocate memory through this entry point,
> or does it call itself directly?

Yes, the Exec itself always goes through AllocMem() to obtain memory. I myself
have SetFunction()ed the AllocMem(), FreeMem(), TypeofMem() and AllocAbs()
functions and replaced them with similar ones which use semaphores instead of
Forbid()/Permit() combinations. That fixed an incompatibility with my enhanced
Exec. By the way, you can get a full disassembly from a program called ExecDis,
by Markus Wandel. (God bless him) It's been plunged in FishBowl #188.

Valentin
_________________________________________________________________________
"An  operating  system  without         Name:   Valentin Pepelea
 virtual memory is an operating         Phonet: (613) 231-7476
 system without virtue."                Bitnet: 451061@Uottawa.bitnet
                                        Usenet: Use cunyvm.cuny.edu gate
         - Ancient Inca Proverb         Planet: 451061@acadvm1.UOttawa.CA