Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!iconsys!caeco!i-core!geo-works!bryan From: bryan@geo-works.UUCP (Bryan Ford) Newsgroups: comp.sys.amiga.tech Subject: Freeing memory on demand Message-ID: <1929.AA1929@geo-works> Date: 22 Jul 89 16:11:14 GMT Followup-To: comp.sys.amiga.tech Lines: 33 Is there a way to make AllocMem() call your own routine if it is about to fail? In other words, I'd like to do the same thing as libraries and devices do when memory is low and they're not being used. I know I could patch into AllocMem, but that would create all the problems of SetFunction(), and I really don't want to get into that. I'd rather not mess around with SysBase anyway. I could also add a 'dummy' library to the library list with an Expunge() function that calls my de-allocation routine. I don't really want to do this either, because of the extra library management code it would require. But, unless someone "out there" can give me a better way, this is how I'll do it. Also, if there isn't a better way than this, and nothing to handle this is coming out in 1.4, may I suggest creating a standard library which goes in the LIBS: directory, called, say, "demandfree.library" or something like that. It would maintain a list of routines to call whenever it gets an Expunge() request from the system. It wouldn't be hard at all to create, but could be extremely helpful. Thanks in advance! Bryan P.S. Yes, this *is* necessary in my case. I'm doing lots of caching in chip memory, and I can't keep caches hanging around when somebody else (or another part of my program) needs the memory. -- _______________________________________ _/ 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______________/