I would like to allocate space (dynamic size) with a byte array and get a pointer to the “spacearea” and free it later if I don’t need it anymore.
I know about VirtualAlloc, VirutalAllocEx and LocalAlloc.
Which one is the best and how can I free the memory afterwards?
Thank you for your help.
I don’t think it is a good idea to use the winapi for that instead of the native Pascal functions.
You can simply define an array of bytes as
then it can be allocated by
and freed by
Such an array is reference counted and you can access individual bytes as
yourarray[byteid]Or if you really want pointers, you can use: