Page 1 of 1

Memory ID of Memory Address

Posted: Sat Nov 15, 2003 4:44 pm
by Codemonger
Is their a function to get the memoryID of the address --

Lets say I wan't to store the memory address of the memory ID .. no problem ... But later in my program I would like to use that address to find out the Memory ID it belongs to. Anyone have a solutions or is it already available and I'm just missing it ?

I could recurse a list of memory ID's and check if I get a match, but that seems time consuming or I could build a structure to represent both the MemoryAddress and the ID it belongs to ... ohh thats not such a bad idea, then I could pass the address of the structure to my procedures and create a dummy pointer to the structure .... that might work.

Code: Select all

Structure PBMemory
   MemID.l
   MemAddress.l
EndStructure
Any other ideas ?

Re: Memory ID of Memory Address

Posted: Sun Nov 16, 2003 3:49 pm
by tinman
Codemonger wrote:Any other ideas ?
Store a linked list of your structures. That's probably what PB would have to do internally in the linked list library if it wanted to look up memory ID to bank number.

Bank numbers for memory are a complete pain in the ass if you're doing anything relaitively dynamic. Any news on the #PB_BANK_NUMBER_I_DONT_CARE option for the memory lib Fred?

Posted: Sun Nov 16, 2003 4:40 pm
by Codemonger
You right Tinman they are a pain in the ass, and I am doing dynamic stuff. I only needed the MemoryID to reallocate memory and or to compare memory ... I think, now I can't remember why I needed it ? Oh I'll stumble across it programming today :?:

But what I do like is the automatic allocation and flag setting, also the automatic deletion of the memory when the program ends. I don't have to worry about anything.