home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!darkstar.UCSC.EDU!cats.ucsc.edu!davids
- From: davids@cats.ucsc.edu (Dave Schreiber)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Flushing Devices; C= doco (mutter!)
- Date: 8 Jan 1993 07:06:27 GMT
- Organization: University of California; Santa Cruz
- Lines: 64
- Message-ID: <1ij95jINNmr5@darkstar.UCSC.EDU>
- References: <1993Jan7.092127.13752@philips.oz.au> <1iia8tINNdeh@darkstar.UCSC.EDU> <crystal.726454269@glia>
- NNTP-Posting-Host: si.ucsc.edu
-
-
- In article <crystal.726454269@glia> crystal@glia.biostr.washington.edu (Crystal) writes:
- >In <1iia8tINNdeh@darkstar.UCSC.EDU> davids@cats.ucsc.edu (Dave Schreiber) writes:
- >
- >
- >>In article <1993Jan7.092127.13752@philips.oz.au> gduncan@philips.oz.au (Gary Duncan) writes:
- >>>Passing thought ; why the heck aren't unused libraries/devices
- >>>flushed automatically anyway? Sounds like a legacy of the days
- >>>when hard disks were rare and dragging a device off floppy was
- >>>time-consuming. Those days are gone...
- >
- >>Why should they be flushed? An unused library essentially takes up
- >>zero memory, since the memory it uses can be demanded from it at
- >
- >Then how come running "avail flush" returned 75k of memory to me if they
- >take up ZERO memory...?
-
- I said "_essentially_ takes up zero memory." See below for the reason.
-
- >
- >>any time (and will be demanded from it before a memory allocation
- >>is allowed to fail). The only people for whom auto-removal of
- >>libraries is important are developers who are checking for memory
- >
- >Warning: you are dealing in absolutes here... developers are not the ONLY
- >people for whom auto-removal of libraries is important. Those with
- >little ram trying to run DTP programs or Database programs that access
- >large textfiles or graphics likewise need to be able to have as much memory
- >available to them as possible for their work, too.
-
- Reread what I said above. If AllocMem() cannot allocate a block of memory
- of requested size, it will flush all unused libraries and devices from
- memory and try again. A memory allocation _cannot_ fail because needed
- memory is being occupied by a shared library or device.
-
- >
- >>leaks; there are plenty of ways of flushing libraries on those
- >>rare occassions when it is needed.
- >
- >Ok, so, other than "avail flush", what other ways are there? I want to
- >recover as much as I can from those programs that don't clean up after
- >themselves.
-
- The following will work since the AllocMem() will always fail and thus
- will always try and flush unused libraries and devices from memory
- (unless, of course, the user has a chunk of memory 4G-16K large).
-
- APTR *foo;
- foo=AllocMem((unsigned long)(-16384),0L);
-
- Also, if you run Workbench with the -debug option, you get a menu
- called "Debug" that contains an item called "flushlibs" that does
- the same thing.
-
- BTW, since the retaining of unused libraries in memory is an OS
- service, I'd hardly call it a case of programs "not cleaning up
- after themselves."
-
- >>>Gary Duncan gduncan@rosella.pts.philips.oz.au
- >>Dave Schreiber "Look. Don't touch." davids@cats.ucsc.edu (until 6/20/93)
-
-
- --
- Dave Schreiber "Look. Don't touch." davids@cats.ucsc.edu (until 6/20/93)
-