C# Class IronPython.Modules.MemoryHolder

A wrapper around allocated memory to ensure it gets released and isn't accessed when it could be finalized.
Inheritance: System.Runtime.ConstrainedExecution.CriticalFinalizerObject
Afficher le fichier Open project: jschementi/iron Class Usage Examples

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
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

Method Details

CopyFrom() public méthode

Copies the data in data into this MemoryHolder.
public CopyFrom ( IntPtr source, IntPtr size ) : void
source System.IntPtr
size System.IntPtr
Résultat void

CopyTo() public méthode

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
Résultat void

GetSubBlock() public méthode

public GetSubBlock ( int offset ) : MemoryHolder
offset int
Résultat MemoryHolder

MemoryHolder() public méthode

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
Résultat System

MemoryHolder() public méthode

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
Résultat System

ReadByte() public méthode

public ReadByte ( int offset ) : byte
offset int
Résultat byte

ReadInt16() public méthode

public ReadInt16 ( int offset ) : short
offset int
Résultat short

ReadInt32() public méthode

public ReadInt32 ( int offset ) : int
offset int
Résultat int

ReadInt64() public méthode

public ReadInt64 ( int offset ) : long
offset int
Résultat long

ReadIntPtr() public méthode

public ReadIntPtr ( int offset ) : IntPtr
offset int
Résultat System.IntPtr

ReadMemoryHolder() public méthode

public ReadMemoryHolder ( int offset ) : MemoryHolder
offset int
Résultat MemoryHolder

WriteByte() public méthode

public WriteByte ( int offset, byte value ) : void
offset int
value byte
Résultat void

WriteInt16() public méthode

public WriteInt16 ( int offset, short value ) : void
offset int
value short
Résultat void

WriteInt32() public méthode

public WriteInt32 ( int offset, int value ) : void
offset int
value int
Résultat void

WriteInt64() public méthode

public WriteInt64 ( int offset, long value ) : void
offset int
value long
Résultat void

WriteIntPtr() public méthode

public WriteIntPtr ( int offset, IntPtr value ) : void
offset int
value System.IntPtr
Résultat void

WriteIntPtr() public méthode

public WriteIntPtr ( int offset, MemoryHolder address ) : void
offset int
address MemoryHolder
Résultat void