[Glass] How can I release a malloced CByteArray ....
James Foster
james.foster at gemtalksystems.com
Wed Feb 26 08:42:19 PST 2014
I’ll let you take that up with the authors of the external library. In the off chance that you are faced with a situation where the authors do not accept your suggestion to rewrite their library, you can still use it.
James
On Feb 26, 2014, at 8:28 AM, itlists at schrievkrom.de wrote:
> Hmmm,
>
> I thought that if I talk to an external library it is very good
> programming practice that each component is responsible for allocating
> and freeing their memory. This is very true, if both systems are working
> with different memory allocation libraries.
>
> That means, if I give a malloced memory to an external library the
> external library should not free "my" memory.
>
> Marten
>
>
> Am 26.02.2014 17:12, schrieb James Foster:
>> The short answer is “you can’t!” As indicated in the method comment, this is intended to be used to pass to C functions that take responsibility for freeing the memory. In most cases you should use CByteArray class>>#'gcMalloc:’ so that the external memory is freed automatically when the object is no longer referenced within Smalltalk.
>>
>
>
>
> --
> Marten Feldtmann
More information about the Glass
mailing list