home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18331 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  3.1 KB

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