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))Constructor
Creates a MemoryBlock from an existing block of memory of a specific size.
Parameters
Parameter | Description |
---|---|
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. |
Notes
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.
Exceptions
- NilObjectException if p is Nil.
- RuntimeException if size is 0 or if it can be determined that p is neither readable or writeable.