Page 1 of 1

Memory

Posted: Sat May 29, 2004 7:07 pm
by Polo
Hi !
I'm searching for a good way to manage memory, but without using :
AllocateMemory PB function or Heap Memory API function, coz they don't seem to work differently according to Windows version
without linked list/dim functions coz it can't do what i need :)

i'll be really happy for suggestions :)

Posted: Sat May 29, 2004 7:15 pm
by fweil
Polo,

Sorry if I misunderstand you or if I don't read between lines, but your question sound weird to me.

Maybe you will give a more clear 'What I would like to do' instead of what you don't want.

Do not understand this a criticism but the only way to not use provided functions to manage memory would be to use Peeks and Pokes probably, except in a focused given intention, in which case it is maybe possible to adapt structures ...

Be your question more accurate, maybe we will have a better answer.

Rgrds

Posted: Sat May 29, 2004 8:36 pm
by Polo
Sorry, I'm going to tell again my problem :)

I want to store datas in memory, but I don't want to use allocatememory/api memory function/linked list/dim :)

I mean, usually we do this :

buff=AllocateMemory(16) ; <= I would like to change this :)
pokeL(buff,58)
pokeL(buff+4,187)
[...]

Posted: Sat May 29, 2004 9:15 pm
by jack
this is probably not good programming practice, but you can put a readable/writable data segment at the end of your app.
something like this:

Code: Select all

! section '.data' Data readable writeable
buf:     
! Repeat 16
!   db      ?   ;reserve byte  (times 16)
! End Repeat
you can then peek and poke data into buf

Posted: Sat May 29, 2004 9:58 pm
by fweil
Well, maybe this answers better :

Code: Select all

Dim a.l(4)

*Buffer = @a(0)
PokeL(@a(0), 58)
PokeL(@a(1), 187)

Debug PeekL(*Buffer)
Debug PeekL(*Buffer + 4)
This makes equivalence between a *Buffer (which is a memory address and nothing else) and an array.

Rgrds

Posted: Mon May 31, 2004 10:03 pm
by freak
Why don't you want to use AllocateMemory() or HeapAlloc_() ?
A PB program uses it alot, without you even knowing it, so why avoid it? :wink:

Timo