Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!agate!ucbvax!POSTGRES.BERKELEY.EDU!dillon From: dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga.tech Subject: Re: memalign (can it be simulated?) Message-ID: <8902100710.AA16214@postgres.Berkeley.EDU> Date: 10 Feb 89 07:10:03 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 30 :Ahem, ... I'm probably going to be shot for this, but: only expect that :behaviour on a BSD-like UN*X system. As I understand it, BSD does not :return free'd memory (as in the sbrk() system call) back to the system. :That's why the reference will still work. (Of course, on a BSD machine :you can allocate 4MB of RAM then free 3MB while the operating system :doesn't actually make that 3MB available to other tasks... Wonder what :database managers do about that?!) You are right and you are wrong. BSD 4.2/4.3 (and most UNIX systems) has .. TADA! Demand-Paged- Virtual-Memory. That 3MB that was freed takes up space on the SWAP device, but not necessarily in physical memory. In fact, unless you actually use what you malloc() (for large malloc'd chunks) in a UNIX system, it will NEVER be brought into physical memory. Unused or infrequently used portions of allocated, stack, & text space does not take up physical memory ... what little it does take up will be paged out most of the time... faster if the system is running out of physical memory to play with. Needless to say, most systems have a LOT of swap ... in the hundreds of megabytes or even Gig(gle)bytes. >Well, I've stuck my neck out -- does anyone know differently??? > >Frank "Crash" Edwards >"No one knows the trouble I've seen..." -Matt