C# Класс IronPython.Modules.MemoryHolder

A wrapper around allocated memory to ensure it gets released and isn't accessed when it could be finalized.
Наследование: System.Runtime.ConstrainedExecution.CriticalFinalizerObject
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CopyFrom ( IntPtr source, IntPtr size ) : void

Copies the data in data into this MemoryHolder.

CopyTo ( MemoryHolder destAddress, int writeOffset, int size ) : void

Copies memory from one location to another keeping the associated memory holders alive during the operation.

GetSubBlock ( int offset ) : MemoryHolder
MemoryHolder ( IntPtr data, int size ) : System

Creates a new MemoryHolder at the specified address which is not tracked by us and we will never free.

MemoryHolder ( IntPtr data, int size, MemoryHolder parent ) : System

Creates a new MemoryHolder at the specified address which will keep alive the parent memory holder.

ReadByte ( int offset ) : byte
ReadInt16 ( int offset ) : short
ReadInt32 ( int offset ) : int
ReadInt64 ( int offset ) : long
ReadIntPtr ( int offset ) : IntPtr
ReadMemoryHolder ( int offset ) : MemoryHolder
WriteByte ( int offset, byte value ) : void
WriteInt16 ( int offset, short value ) : void
WriteInt32 ( int offset, int value ) : void
WriteInt64 ( int offset, long value ) : void
WriteIntPtr ( int offset, IntPtr value ) : void
WriteIntPtr ( int offset, MemoryHolder address ) : void

Приватные методы

Метод Описание
AddObject ( object key, object value ) : void

Used to track the lifetime of objects when one memory region depends upon another memory region. For example if you have an array of objects that each have an element which has it's own lifetime the array needs to keep the individual elements alive. The keys used here match CPython's keys as tested by CPython's test_ctypes. Typically they are a string which is the array index, "ffffffff" when from_buffer is used, or when it's a simple type there's just a string instead of the full dictionary - we store that under the key "str".

EnsureObjects ( ) : PythonDictionary
MemoryHolder ( int size ) : System
ReadAnsiString ( IntPtr addr, int offset ) : string
ReadAnsiString ( IntPtr addr, int offset, int length ) : string
ReadAnsiString ( int offset ) : string
ReadAnsiString ( int offset, int length ) : string
ReadUnicodeString ( int offset ) : string
ReadUnicodeString ( int offset, int length ) : string
WriteAnsiString ( int offset, string value ) : void
WriteUnicodeString ( int offset, string value ) : void

Описание методов

CopyFrom() публичный Метод

Copies the data in data into this MemoryHolder.
public CopyFrom ( IntPtr source, IntPtr size ) : void
source System.IntPtr
size System.IntPtr
Результат void

CopyTo() публичный Метод

Copies memory from one location to another keeping the associated memory holders alive during the operation.
public CopyTo ( MemoryHolder destAddress, int writeOffset, int size ) : void
destAddress MemoryHolder
writeOffset int
size int
Результат void

GetSubBlock() публичный Метод

public GetSubBlock ( int offset ) : MemoryHolder
offset int
Результат MemoryHolder

MemoryHolder() публичный Метод

Creates a new MemoryHolder at the specified address which is not tracked by us and we will never free.
public MemoryHolder ( IntPtr data, int size ) : System
data System.IntPtr
size int
Результат System

MemoryHolder() публичный Метод

Creates a new MemoryHolder at the specified address which will keep alive the parent memory holder.
public MemoryHolder ( IntPtr data, int size, MemoryHolder parent ) : System
data System.IntPtr
size int
parent MemoryHolder
Результат System

ReadByte() публичный Метод

public ReadByte ( int offset ) : byte
offset int
Результат byte

ReadInt16() публичный Метод

public ReadInt16 ( int offset ) : short
offset int
Результат short

ReadInt32() публичный Метод

public ReadInt32 ( int offset ) : int
offset int
Результат int

ReadInt64() публичный Метод

public ReadInt64 ( int offset ) : long
offset int
Результат long

ReadIntPtr() публичный Метод

public ReadIntPtr ( int offset ) : IntPtr
offset int
Результат System.IntPtr

ReadMemoryHolder() публичный Метод

public ReadMemoryHolder ( int offset ) : MemoryHolder
offset int
Результат MemoryHolder

WriteByte() публичный Метод

public WriteByte ( int offset, byte value ) : void
offset int
value byte
Результат void

WriteInt16() публичный Метод

public WriteInt16 ( int offset, short value ) : void
offset int
value short
Результат void

WriteInt32() публичный Метод

public WriteInt32 ( int offset, int value ) : void
offset int
value int
Результат void

WriteInt64() публичный Метод

public WriteInt64 ( int offset, long value ) : void
offset int
value long
Результат void

WriteIntPtr() публичный Метод

public WriteIntPtr ( int offset, IntPtr value ) : void
offset int
value System.IntPtr
Результат void

WriteIntPtr() публичный Метод

public WriteIntPtr ( int offset, MemoryHolder address ) : void
offset int
address MemoryHolder
Результат void