Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
34
Task/Memory-allocation/OxygenBasic/memory-allocation.basic
Normal file
34
Task/Memory-allocation/OxygenBasic/memory-allocation.basic
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
'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
|
||||
Loading…
Add table
Add a link
Reference in a new issue