[squeak-dev] ExternalAddress and block copy;
ByteArray and external calls?
bschwab at anest.ufl.edu
Mon Aug 23 19:46:36 UTC 2010
Are there any well-worn ways to move data into and out of external memory? The best I have been able to uncover are recommendations to either do it one byte at a time (yuk!) or to via bitblt. Those posts come from several years ago, and include mention that ExternalAddress does not clean up after itself. Looking in Pharo now, I see #finalize that calls free; have things move along to avoid memory leaks?
There are no conditions in #finalize or #free, which raises questions about whether it is safe to send #free to quickly free memory that will no longer be used? In Dolphin, I reflexively free ODBC related handles because they quickly pile up and cause problems despite the finalization "water mark." I am currently working with a data acquisition board and will be needing memory for clearly defined periods. I also need to get data out of the buffers, which sent me looking for an official way to do so.
To what extent, if any, can String and ByteArray be used as buffers for external calls? Dolphin made that robust, but there were hints that the gc was slightly tamed to allow it. The little reading I have done in squeak-dev archives suggests that squeak/pharo is not so forgiving. Is that true? Is there a way to request a byte array allocated in a fixed (or whatever the jargon is) heap so that external calls will be safe?
More information about the Squeak-dev