Memory allocation: Difference between revisions
Content added Content deleted
(Added solution for Action!) |
|||
Line 1,077: | Line 1,077: | ||
You can allocate a block of memory (on the heap) by creating a MemBuffer object, which is an array of bytes. |
You can allocate a block of memory (on the heap) by creating a MemBuffer object, which is an array of bytes. |
||
=={{header|OxygenBasic}}== |
|||
<lang> |
|||
'ALLOCATING MEMORY FROM DIFFERENT MEMORY SOURCES |
|||
sys p |
|||
static byte b[0x1000] 'global memory |
|||
p=@b |
|||
function f() |
|||
local byte b[0x1000] 'stack memory in a procedure |
|||
p=@b |
|||
end function |
|||
p=getmemory 0x1000 'heap memory |
|||
... |
|||
freememory p 'to disallocate |
|||
sub rsp,0x1000 'stack memory direct |
|||
p=rsp |
|||
... |
|||
rsp=p 'to disallocate |
|||
'Named Memory shared between processes is |
|||
'also available using the Windows API (kernel32.dll) |
|||
'see MSDN: |
|||
'CreateFileMapping |
|||
'OpenFileMapping |
|||
'MapViewOfFile |
|||
'UnmapViewOfFile |
|||
'CloseHandle</lang> |
|||
=={{header|PARI/GP}}== |
=={{header|PARI/GP}}== |