FFI and GC Question

From: <dtillman_at_ozarkaircraftsystems.com>
Date: Fri, 2 Jun 2000 10:47:03 -0500

  Hello all, I have not been subscribed to the list for a year
  or so - changing employers and so forth.

  Around a year ago I wrote a gdbm interface for the FFI. I just
  revisited it this week and it occured to me that I am not making
  any effort to free the pointer of a value returned by a key.

  (For those that are not familiar with gdbm, it leaves it up
  to you to free the memory pointed when you are done with it.)

  My question is, looking at the FFI below, is the dynamic-ptr
  that is returned subject to gc or do I need to free it explicitly?

;; Fetch. Returns a c-pointer. Use c-string->string to translate.
(define-external gdbm-fetch ((dbf :int)
                             (key :string))
  :return-type :dynamic-ptr
  :entry-name "new_gdbm_fetch"
  :library-name "/home/dtillman/tmp/libstk-gdbm")

  I suspect that the later is true as through testing I have
  determined that memory usage stops growing after about 3000
  fetches. (Also, I managed to belly-up stk by freeing the
  pointers manually after each fetch).

  Your comments are welcome.


David Tillman                      |  System Administrator
dtillman_at_ozarkaircraftsystems.com  |  Ozark Aircraft Systems
Received on Fri Jun 02 2000 - 17:53:03 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST