Article View: comp.sys.amiga.tech
Article #11400Re: memalign (can it be simulated?)
From: Michael "Ford" Ditto
Date: Fri, 10 Feb 1989 04:33
Date: Fri, 10 Feb 1989 04:33
34 lines
2130 bytes
2130 bytes
Time to consider following-up to comp.unix.wizards ...
In article <567@jc3b21.UUCP> crash@jc3b21.UUCP (Frank J. Edwards) writes:
>> while(p!= NULL) { free(p); p = p->next; }
>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.
I don't know of any malloc() implementation for Unix that gives back
freed memory. It is just assumed that either the program will malloc
it again or that those pages will be paged out by the OS. This is
almost always a reasonable thing to do.
(A Unix program which is permanently freeing a large chunk of memory
probably should have gotten it via sbrk() in the first place, and can
attempt to free it in the same way. This similarly applies to Amiga
programs with respect to malloc() vs. AllocMem(), especially considering
that there is very little overhead involved in AllocMem compared to a
Unix system call.)
>System V machines, however, actually remove those memory pages from
>the tasks allocation tables -- the memory is GONE!
This is not true with the supplied malloc libraries. Such a library
could be written, but I doubt it would be of much use, for reasons
that are not really related to comp.sys.amiga.* subject matter.
--
-=] Ford [=-
"The number of Unix installations (In Real Life: Mike Ditto)
has grown to 10, with more expected." ford@kenobi.cts.com
- The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford
2nd Edition, June, 1972. ditto@cbmvax.commodore.com
Technical Details
Message-ID:
<5947@cbmvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!amiga!cbmvax!dittoReferences:
<804@sas.UUCP> <567@jc3b21.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!amiga!cbmvax!ditto From: ditto@cbmvax.UUCP (Michael "Ford" Ditto) Newsgroups: comp.sys.amiga.tech Subject: Re: memalign (can it be simulated?) Summary: System V Unix malloc() doesn't call FreeMem() :-) Message-ID: <5947@cbmvax.UUCP> Date: 10 Feb 89 04:33:50 GMT References: <804@sas.UUCP> <567@jc3b21.UUCP> Reply-To: ditto@cbmvax.UUCP (Michael "Ford" Ditto) Organization: Commodore Technology, West Chester, PA Lines: 34