[comp.sys.mac] Purgable blocks in the heap

tomc@mntgfx.mentor.com (Tom Carstensen) (12/16/87)

While I was thumbing through my TMON manual the other day,
I read through the section on the heap.  There is on option
in TMON to continually purge purgable-blocks from the heap.

The manual stated the most Macintosh application DO NOT pass
this test, because they still expect things they loaded into 
memory to be there.

My question is, is it necessary to call HNoPurge (for example)
every time you call GetResource, or can you expect things
loaded into the heap (like with GetResource) to at least be
there until the next ROM call?

Would a call like this be prone to this error:

    DrawPicture(GetPicture(1000), &r);

:------------------------------------------------------------:
: Tom Carstensen              Usenet: tomc@mntgfx.MENTOR.COM :
: Mentor Graphics             GEnie:                         :
:                                                            :
:     . . . and this shall be Max Headroom's finest hour.    :
:                                       - Max Headroom       :
:------------------------------------------------------------:

jwhitnel@csi.UUCP (Jerry Whitnell) (12/18/87)

In article <1987Dec15.143915.593@mntgfx.mentor.com> tomc@mntgfx.mentor.com (Tom Carstensen) writes:
>My question is, is it necessary to call HNoPurge (for example)
>every time you call GetResource, or can you expect things
>loaded into the heap (like with GetResource) to at least be
>there until the next ROM call?

Only if you set the Purge bit on the resource itself.  As long as you don't,
the resource is not purgable and TMON won't purge it.  The problem
most applications have is they dereference the handle to get the
pointer and then call something then purges the handle.  

>
>Would a call like this be prone to this error:
>
>    DrawPicture(GetPicture(1000), &r);

Only if Resource PICT 1000 had the Purge bit set.

>
>: Tom Carstensen              Usenet: tomc@mntgfx.MENTOR.COM :

Jerry Whitnell				Lizzi Borden took an axe
Communication Solutions, Inc.		And plunged it deep into the VAX;
					Don't you envy people who
					Do all the things You want to do?