From: matz@... (Yukihiro Matsumoto) Date: 2001-07-05T12:54:38+09:00 Subject: [ruby-talk:17273] Re: extension and GC Hi, In message "[ruby-talk:17271] Re: extension and GC" on 01/07/05, Shan-leung Maverick WOO writes: |> (2) depends on when do you want to deallocate your memory, but |> global finalizer rb_set_end_proc() may help. See ext/curses.c | |I think this doesn't quite work in my case because the user can potentially |create tons of such objects. To cast the question better, let me put up a |hypothetical scenario: | |- I am going to re-implement the dbm package by inheriting from Hash |(instead of the current way which is to mimic a hash). Ah, how do you going to hold dbm reference? RHash structure has no more room for it. You have to hold dbm reference by either * wrap in C struct (as in dbm extension), then associate it via instance variable. * give up inheriting from Hash, probably having Hash for in-memory cache. you can deallocate memory by C struct free function in both cases. For the latter, don't forget to mark in-memory hash using mark function. This is the best I can say without reading your code. I might be missing something. matz.