WriteData and Invalid memory access
Posted: Tue Feb 15, 2022 12:44 pm
Hi, this code (64 bit compiler - Windows 10 64 bit) get error, i have 32 Gb of DDR4 RAM on Mobo.
where am I wrong ?
LOG
[12:39:55] Waiting for executable to start...
[12:39:55] Executable type: Windows - x64 (64bit, Unicode)
[12:39:55] Executable started.
[12:39:56] [ERROR] test4gb.pb (Line: 6)
[12:39:56] [ERROR] Invalid memory access. (write error at address 36110336)
where am I wrong ?
Code: Select all
Global.q gigs = (4*1000)*1024*1024 ; 4 Gigabyte
*MemoryID = AllocateMemory(gigs) ; allocating a 4 Gigabyte memory block
FillMemory(*MemoryID,gigs,255,#PB_Byte) ; fill a 4 Gigabyte memory block with a 255 byte value
CreateFile(0,"Text.txt") ; create a new file
FileBuffersSize(0,131072) ; create a new buffer of 128K
WriteData(0, *MemoryID, gigs) ; write the 4 Gigabyte memory block into the file
FlushFileBuffers(0) ; flush buffer
CloseFile(0) ; close the opened file
[12:39:55] Waiting for executable to start...
[12:39:55] Executable type: Windows - x64 (64bit, Unicode)
[12:39:55] Executable started.
[12:39:56] [ERROR] test4gb.pb (Line: 6)
[12:39:56] [ERROR] Invalid memory access. (write error at address 36110336)