Memory

Everything else that doesn't fall into one of the other PB categories.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Memory

Post 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 :)
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post 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
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post 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)
[...]
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post 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
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post 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
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
freak
PureBasic Team
PureBasic Team
Posts: 5947
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
Post Reply