I have an array of function pointers and I find the base address of the array memory and turn it into an Int Pointer. Then I can store integers in amongst the function pointers. How I use the contents of the array depends on how I interpret it, either calling a function or reading/writing integer values. This is working fine. But I also need to store references to custom types in the same array.
I have been looking at these two commands:
I am unclear about how to use these (presuming this is the only way to make this work).
If I do MyIntArray[Offset]=HandleFromObject(MyCustomTypeInstance), this appears to store the type in the array once.
If I then do MyCustomType=MyCustomType(HandleToObject(MyIntArray[Offset])), this appears to retrieve the type from the array and change it back into MyCustomType.
However, I am confused by where it says that you have to call Release to release references, in order to keep the Garbage Collector happy. I won't necessarily be writing objects as many times as I read them - more likely they will be written infrequently and read frequently. When exactly do I need to be calling Release? When I *use*/convert the reference back to an object, or perhaps when I plan to delete the entire array? Also when I have converted an object to an integer, can't I store that integer anywhere I like any number of times and the garbage collector will have no idea about that or need to know that? I am just confused about the Release thing.
I have been looking at these two commands:
Function HandleFromObject( obj:Object ) Returns An integer object handle Description Convert object to integer handle Information After converting an object to an integer handle, you must later release it using the Release command. Function HandleToObject:Object( handle ) Returns The object associated with the integer handle Description Convert integer handle to object
I am unclear about how to use these (presuming this is the only way to make this work).
If I do MyIntArray[Offset]=HandleFromObject(MyCustomTypeInstance), this appears to store the type in the array once.
If I then do MyCustomType=MyCustomType(HandleToObject(MyIntArray[Offset])), this appears to retrieve the type from the array and change it back into MyCustomType.
However, I am confused by where it says that you have to call Release to release references, in order to keep the Garbage Collector happy. I won't necessarily be writing objects as many times as I read them - more likely they will be written infrequently and read frequently. When exactly do I need to be calling Release? When I *use*/convert the reference back to an object, or perhaps when I plan to delete the entire array? Also when I have converted an object to an integer, can't I store that integer anywhere I like any number of times and the garbage collector will have no idea about that or need to know that? I am just confused about the Release thing.