Board index » delphi » accessing memory allocated with GETMEM
jas...@athena.sunitafe.edu.au (squigger)
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
jas...@athena.sunitafe.edu.au (squigger)
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
accessing memory allocated with GETMEMHow do I access the memory allocated by this statement : getmem(apointer, 1024); Please don't tell me it works like this : apointer^[0] := 56; because this doesn't work - I'm using TP6 if it helps. squigger hops again |
Jochen Heylan
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMQuotesquigger wrote: is you're storing in your memory. The most general way would be: type ... getmem(apointer, 1024); Not that in this general case apointer^[1025] will not Hope this helps, |
squigg
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMIn article <332FD303....@berlin.snafu.de>, joch...@berlin.snafu.de Quote
programme)? Or can't it be done (wouldn't surprise me...) squigger hops again |
Schoeneck Howe
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMOn 19 Mar 97 22:02:36 GMT, jas...@athena.sunitafe.edu.au (squigger) Quote>In article <332FD303....@berlin.snafu.de>, joch...@berlin.snafu.de move(var source, dest; count : word) move copies a block of 'count' bytes starting at the first byte of 'source' could be the entity you generate w/ getmem, an element BTW, using the sizeof function is the safe way to define count Nick |
squigg
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMIn article <33308499.292411...@nntp.ix.netcom.com>, Quote
size to make the arrays. Thanks otherwise - I can use that with preset tiles. squigger hops again |
Dr John Stockto
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMIn article <3330627...@ren2.netconnect.com.au> of Wed, 19 Mar 1997 Quotedu.au> wrote: to a random-sized byte array and reads a random byte which may or may not be within the allocated array. ISTM that it it is range-check safe :-( . program xx ; type AB = array [0..$FFF0] of byte ; PAB = ^AB ; var V : PAB ; B : byte ; begin Write('A') ; Randomize ; GetMem(V, random($FFF1)) ; B := V^[random($FFF1)] ; Writeln('B') ; Readln end. Is this random enough as a demonstration? |
squigg
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMIn article <9911ULA7nRMzE...@merlyn.demon.co.uk>, j...@merlyn.demon.co.uk Quote
Quote>du.au> wrote: Thanks, I can see how that works (for once! Yippee! I understand it!). But that wastes memory, doesn't it? I'm not sure... BTW, how does the graph unit handle memory allocated with getmem (as in squigger hops again |
squigg
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMIn article <3331dec8.381047...@nntp.ix.netcom.com>, Quote
squigger hops again |
Schoeneck Howe
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMOn 20 Mar 97 21:59:14 GMT, jas...@athena.sunitafe.edu.au (squigger) Quote
element in the array .... it just defines a structure that COULD access those elements. Even if you define a [1..$FFF0] array, you can't use the $F000'th element unless you Getmem'd at least a $F000 sized space... As to use, use it like any other pointer referenced string of bytes! Nick |
Dr John Stockto
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:accessing memory allocated with GETMEMIn article <3331b33...@ren2.netconnect.com.au> of Thu, 20 Mar 1997 Quotedu.au> wrote: AND <jas...@athena.sunitafe.edu.au> wrote Quote
undoing the GetMem. Quote>BTW, how does the graph unit handle memory allocated with getmem (as in Please do not respond unnecessarily to News in both mail & news, as it |
1. How to determine size allocated with AllocMem/GetMem ?
2. dynamically allocating space for arrays using getmem or new procedure in Delphi 3
3. getmem(2500) = getmem(2504)???
4. Q: Allocating XMS at the Top of Memory
6. Allocating memory under protected mode (BP7)
7. Allocating memory in a C++-DLL - Freeing it in a Delphi 3 Application