Page 1 of 1

Posted: Fri Feb 28, 2003 12:57 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.

If I want to reserve a mem bank and avoid conflict is it ok to use
say 999 as mem bank number, ie, PB won't go creating 998 other
entries in a table somewhere? I expect PB is using a linked list
to store -to- pairings but thought I'd
ask because I may end up using a very large mem bank number.

Posted: Fri Feb 28, 2003 1:29 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by dmoc

If I want to reserve a mem bank and avoid conflict is it ok to use
say 999 as mem bank number, ie, PB won't go creating 998 other
entries in a table somewhere? I expect PB is using a linked list
to store -to- pairings but thought I'd
ask because I may end up using a very large mem bank number.
Fred is working now to remove memory bank numbers, or at least make them optional. I don't think PureBasic would use the memory banks internally, as they should be for our use.

One other thing you might want to try, is that if you are not doing something where the pointer to your memory bank is going to change memory location, i.e. if you are using an array to store bank pointers but you will not sort them, you could make the address of your pointer as the memory bank number, i.e.

Code: Select all

*some_memory = AllocateMemory(@*some_memory, size, flags)
Depending on your needs for the memory banks, you might then never have any conflicts.


--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + all updates, PB3.51, Ed3.53)

Posted: Fri Feb 28, 2003 1:35 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

If you want to avoid any Conflict, you can use GlobalAlloc_(). You then only get a Memory Address, and no Bank Numbers are needed.

Timo

Posted: Fri Feb 28, 2003 2:13 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.

Thanks both.

Posted: Fri Feb 28, 2003 3:23 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

no, PB allocates bank contigously, which means, than 1000 banks allocates 1000 slots. For memory bank, it probably not needed and I could remove it soon.

Fred - AlphaSND

Posted: Sun May 11, 2003 9:54 pm
by dmoc
"I could remove it soon" - for the next release? It's beginning to cause me a problem because I need to allocate using arbitrary bank numbers but I still want to avoid a Windows specific solution.

Posted: Sun May 11, 2003 10:39 pm
by tinman
dmoc wrote:"I could remove it soon" - for the next release? It's beginning to cause me a problem because I need to allocate using arbitrary bank numbers but I still want to avoid a Windows specific solution.
You could use my RawMemory library if you are willing to write the Linux version of the code ;)

Posted: Sun May 11, 2003 11:26 pm
by dmoc
Tinman, thanks for your library and I will take a look sometime (re Linux) but at the mo I'm trying to avoid any more distractions. I already have enough working around quite a few PB issues :?

Posted: Mon May 12, 2003 12:13 pm
by dmoc
Related question: gadget numbers have to be unique but does this include window numbers and mem bank numbers? Eg, if I want banks # 0 to 100 does that mean gadget/ window numbers must >100?

Posted: Mon May 12, 2003 8:00 pm
by tinman
dmoc wrote:Related question: gadget numbers have to be unique but does this include window numbers and mem bank numbers? Eg, if I want banks # 0 to 100 does that mean gadget/ window numbers must >100?
No, every library has it's own set of numbers.

Posted: Mon May 12, 2003 11:52 pm
by dmoc
Tinman, thanks for the info.