[comp.sys.amiga.tech] AllocRemember & FreeRemember

intern@dasys1.UUCP (intern ) (03/15/89)

In article <1452@percival.UUCP> baer@percival.UUCP (Ken Baer) writes:
>Yes, we use AllocRemember() all the time...  The drawback is you have to
>keep track of all your keys, which can get messy if you're not careful.
>	-Ken Baer.  					 
>   //   Hash Enterprises: When the Going gets Wierd, the Wierd go Professional

Is it possible to deallocate only part of the memory that was allocated
using a specific key?  In other words, I want to use AllocRemember with a
single key for all my allocations, so I could free up all the memory in one
shot upon exit from my program.  But during the course of my program execution,
I would like to free up selected chunks of memory, (without freeing up all of
it).  Is that doable?

	Thanks,
		- Steve -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve Faiwiszewski	bang   :  {sun!hoptoad , cmcl2!phri} !dasys1!intern 
			domain : intern@dasys1.UUCP
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve Faiwiszewski	bang   :  {sun!hoptoad , cmcl2!phri} !dasys1!intern 
			domain : intern@dasys1.UUCP
	    Help save a tree: Print on both sides of the paper

adam@cbmvax.UUCP (Adam Levin CATS) (03/15/89)

In article <9004@dasys1.UUCP> intern@dasys1.UUCP (intern ) writes:
>In article <1452@percival.UUCP> baer@percival.UUCP (Ken Baer) writes:
>>Yes, we use AllocRemember() all the time...  The drawback is you have to
>>keep track of all your keys, which can get messy if you're not careful.
>>	-Ken Baer.  					 
>>   //   Hash Enterprises: When the Going gets Wierd, the Wierd go Professional
>
>Is it possible to deallocate only part of the memory that was allocated
>using a specific key?  In other words, I want to use AllocRemember with a
>single key for all my allocations, so I could free up all the memory in one
>shot upon exit from my program.  But during the course of my program execution,
>I would like to free up selected chunks of memory, (without freeing up all of
>it).  Is that doable?
>
>	Thanks,
>		- Steve -
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Steve Faiwiszewski	bang   :  {sun!hoptoad , cmcl2!phri} !dasys1!intern 
>			domain : intern@dasys1.UUCP
[duplicate .signature deleted]

Yes, it is possible.  I wrote a routine to do this; I'll see if
we (C-A) want to release it.
To Ken Baer:  You said you have to "keep track of all your keys".
Are you sure you are using AllocRemember correctly?  You only need
to declare one key (one instance of a pointer to a Remember structure).
Then you keep passing the address of that key to subsequent calls to
AllocRemember, and finally to FreeRemember.  If you are declaring a key
for each allocation, you are missing the whole benefit of AllocRemember.

-- 
     Adam Keith Levin  --  CATS   Commodore-Amiga Technical Support
     1200 Wilson Drive / West Chester, PA  19380     (215) 431-9180
     BIX: aklevin        UUCP: ...{amiga|rutgers|uunet}!cbmvax!adam