This is the mail archive of the guile-gtk@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Added a bunch of GDK routines.


Kevin Ryde <user42@zip.com.au>:

> Marko Rauhamaa <marko@pacujo.net> writes:
> >  - guile-gtk.[ch]: Made xmalloc and xrealloc non-static
> 
> Might be prudent to rename them to sgtk_something.

Might be.

> I guess it might be nice to use scm_malloc to gc if out of memory, but
> I'm not smart enough to know if that'd cause subtle problems.

The current situation is not perfect since we are not telling the
garbage collector of the "hidden" memory we are allocating. Even when we
are not using scm_must_malloc, we should call scm_done_malloc with a
positive argument during allocation and with a negative argument when we
free memory to let GC have an idea of memory consumption
(http://home.thezone.net/~gharvey/guile/gc/gc-mistakes_3.html).

If we call scm_must_malloc (and we should), we scm_done_malloc is not
necessary during allocation, but you still have to call it with a
negative size at freeing time.

Finally, the GTK, GDK and Xlib routines also allocate memory, and
ideally we'd like to be able to report it to guile's GC. The 'size
option is already there (albeit currently unused) to report the size to
build-guile-gtk-1.2.

The only "subtlety" I'm aware of is smobs that are not yet tied to
other smobs. They might accidentally get wiped out during GC.


Marko

-- 
Marko Rauhamaa      mailto:marko@pacujo.net     http://pacujo.net/marko/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]