[comp.sys.amiga] MEMF_PUBLIC

peter@sugar.UUCP (Peter da Silva) (12/03/87)

In mail, Howard Hull (hull@hao):
> Subject: Re: Memory Management
> 
> Aw c'mon Peter, don't tease.  If you want to goad Amiga programmers through
> insinuating that they should not only have the RKM, but that they should READ
> it, and then that they should UNDERSTAND it, and then (gasp) they should APPLY
> their understanding and thus reflexively know when they should use MEMF_PUBLIC
> in their programs, you should provide the result of YOUR consideration of
> these things as a summary in the same article.  I have read the RKM, and all
> I know is that you want to use MEMF_PUBLIC for data that you want to make
> available (on a r/w basis) for other programs.  For ANYTHING ELSE, you do
> not want to use MEMF_PUBLIC.  Is that so?

Sorta.

From the way it's used in the RKM, MEMF_PUBLIC seems to be used for any memory
that's not going to be your personal property (manipulated exclusively
by you and the libraries -- libraries operate in your task context).

So, to begin with, just about anything that's MEMF_CHIP should also be
MEMF_PUBLIC. Any messages you allocate should be MEMF_PUBLIC. Menus should
be MEMF_PUBLIC. Gadget lists should be MEMF_PUBLIC.

By and large, people seem to be using MEMF_PUBLIC blindly on any memory they
allocate, so they should be OK. The one exception is gadget lists and menus,
although I have seen people statically allocating the occasional message port.
(for example, the mouse stuff just done by kodiak@amiga.UUCP (Robert R. Burns)).
I'm guilty of having static gadget lists myself, though I stick them in a
seperate module so that when the day of reckoning comes the Son Of FixHunk
(or whatever the program that is used to patch 1.1 programs so they can work
with FAST memory is called) can work. I do allocate menus dynamically.

If this stuff is widespread, then we'll find that intuition and device drivers
will have to be run in supervisor mode. Oh well, they're trusted programs
anyway. They're not gonna GURU you... right? Right? Hello?
-- 
-- Peter da Silva  `-_-'  ...!hoptoad!academ!uhnix1!sugar!peter
-- Disclaimer: These U aren't mere opinions... these are *values*.