This is the mail archive of the
mailing list for the Guile project.
Re: New smob interface
Klaus Schilling <Klaus.Schilling@home.ivm.de> writes:
> Greg Harvey writes:
> > Mikael Djurfeldt <email@example.com> writes:
> > > But, we never told it that sizeof (WINDOW) bytes was allocate in the
> > > first place! This is normally handled inside scm_must_malloc. (All
> > > Guile objects have their storage allocated using that call.)
> > Here you should use scm_done_malloc. There should also be a
> > scm_done_free call, so that you don't have to return the size freed to
> > the gc, which can be unwieldy if you have a large, dynamic
> > structure (I think it's a bit gross, anyway ;).
> Where should those routines be placed? Immediately after the function
> that allocates/frees a struct which gets wrapped into a smob
Yep. You want to do something like:
> Before or after a gh_allow_ints()? (If it really makes sense to call
> gh_defer_ints before)
Shouldn't make any difference, except that if it's not in a
defer_ints, the done_malloc can trigger a gc.