Xojo.Core.MemoryBlock.Constructor(p As Ptr, size As UInteger)
From Xojo Documentation(Redirected from Xojo.Core.MutableMemoryBlock.Constructor(p As Ptr, size As UInteger))
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
Creates a MemoryBlock from an existing block of memory of a specific size.
|p||A Ptr that points to a chunk of memory that was allocated using some other method such as a Declare to an OS API call.|
|size||The size (in bytes) of the allocated memory as either a 32-bit or 64-bit unsigned integer depending on the OS. This size is used for bounds checking on the various getter and setter functions.|
The pointer p serves as the MemoryBlock's backing. Mutating the MemoryBlock will also mutate the contents of the block of memory. The MemoryBlock does not take ownership of the memory, so the application is responsible for freeing it after the MemoryBlock has been destructed. If it is freed before then, all MemoryBlock behavior is undefined and will likely crash.