Re: [racket] Freeing FFI resources

2010-10-13 Thread Eli Barzilay
9 minutes ago, Neil Toronto wrote: > Eli Barzilay wrote: > > But of course if the problem is the original one in this thread, where > > each C string eventually needs to be converted to a Racket string, > > then there's little point in holding on to a pointer instead of > > converting it immediatel

Re: [racket] Freeing FFI resources

2010-10-13 Thread Neil Toronto
Eli Barzilay wrote: But of course if the problem is the original one in this thread, where each C string eventually needs to be converted to a Racket string, then there's little point in holding on to a pointer instead of converting it immediately (and freeing the C pointer). True, dat. With

Re: [racket] Freeing FFI resources

2010-10-11 Thread Eli Barzilay
20 minutes ago, Neil Toronto wrote: > Eli Barzilay wrote: > > 5 hours ago, Neil Toronto wrote: > >> I'd be wary of the bytes/free example: I'd free the bytes ASAP > >> instead of using a finalizer. > > > > That shouldn't be a problem. > > Not for correctness, no. How about for time or memory effi

Re: [racket] Freeing FFI resources

2010-10-11 Thread Neil Toronto
Eli Barzilay wrote: 5 hours ago, Neil Toronto wrote: I'd be wary of the bytes/free example: I'd free the bytes ASAP instead of using a finalizer. That shouldn't be a problem. Not for correctness, no. How about for time or memory efficiency? I confused the crap out of Racket's GC by keeping

Re: [racket] Freeing FFI resources

2010-10-11 Thread Eli Barzilay
5 hours ago, Neil Toronto wrote: > > I'd be wary of the bytes/free example: I'd free the bytes ASAP instead > of using a finalizer. That shouldn't be a problem. > I confused the crap out of Racket's GC by keeping externally-managed > memory around that was pointed at by Racket-owned objects wi

Re: [racket] Freeing FFI resources

2010-10-11 Thread Jon Zeppieri
On Mon, Oct 11, 2010 at 2:02 PM, Neil Toronto wrote: > Eric Dobson wrote: >> >> I am dealing with a foreign library that has functions that return >> error messages in a char** input argument. These need to be explicitly >> freed by calling another function. I figured out how to get them into >> r

Re: [racket] Freeing FFI resources

2010-10-11 Thread Neil Toronto
Eric Dobson wrote: I am dealing with a foreign library that has functions that return error messages in a char** input argument. These need to be explicitly freed by calling another function. I figured out how to get them into racket strings by using the _ptr and the _string ctype. But I didn't s

Re: [racket] Freeing FFI resources

2010-10-10 Thread Jon Zeppieri
On Sun, Oct 10, 2010 at 5:40 PM, Eric Dobson wrote: > I am dealing with a foreign library that has functions that return > error messages in a char** input argument. These need to be explicitly > freed by calling another function. I figured out how to get them into > racket strings by using the _p

[racket] Freeing FFI resources

2010-10-10 Thread Eric Dobson
I am dealing with a foreign library that has functions that return error messages in a char** input argument. These need to be explicitly freed by calling another function. I figured out how to get them into racket strings by using the _ptr and the _string ctype. But I didn't see a way to capture t