unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Re: GC ??
@ 2003-12-03 12:58 dv.praveen
  2003-12-03 17:08 ` Matthias Koeppe
  0 siblings, 1 reply; 10+ messages in thread
From: dv.praveen @ 2003-12-03 12:58 UTC (permalink / raw)


hi Matthias,
I am trying to understand Andreas and your mail.
I still have few questions.

+ There would be 3 heaps for program that we write
  a. C heap
  b. C/Scheme heap
  c. Scheme heap.
+ The C heap would not be traced by GC.
+ It is in the Scheme heap GC is going to trace.

What is C/S heap for?
Is it in the Scheme heap guile creates 'heap segments'
for storing Scheme objects?

Andreas told about the function 'scm_permanent_object'.
Given an SCM object to this function where would it
get stored? Would the given value never be reached by
GC or it would be skipped by GC?

What is the difference b/w storing a SCM value using
scm_permanent_object and protecting using guardian proc
returned by scm_make_guardian? Why doesn't guardian proc
work for the program I wrote?

Can you please explain?

regards,
Praveen
 




Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de>
03/12/2003 04:14 PM

 
        To:     D.V. Praveen/Intl/Skyworks@Skymail
        cc:     guile-user@gnu.org@SMTP@Exchange
        Subject:        Re: GC ??

dv.praveen@skyworksinc.com writes:

> My question is still unasnwered.  Shouldn't the
> garbage collector attend all the globals and the
> recurse on the internal scm objects during the
> trace operation?

The garbage collector only scans the Scheme heap and the C/Scheme
stack, but neither the global C data nor the C heap.  I think the
rationale is that it would be very expensive to scan these memory
regions because they may be very large and contain only very few
Scheme objects.  Moreover, they may contain many "false pointers" that
look like Scheme objects, which would make garbage collection
ineffective. 

Therefore one needs to manually protect Scheme objects that are stored
in these memory regions from being garbage collected.

-- 
Matthias Koeppe -- http://www.math.uni-magdeburg.de/~mkoeppe




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <200312030720.hB37Khv7022012@smtp1.urprovider.com>]
* Re: GC ??
@ 2003-12-03  7:20 dv.praveen
  2003-12-03 10:44 ` Matthias Koeppe
  0 siblings, 1 reply; 10+ messages in thread
From: dv.praveen @ 2003-12-03  7:20 UTC (permalink / raw)


hi Andreas Rottmann,
Thank you very much for the reply.  It works. :)
This function was not covered in the documentation
and I missed it.
My question is still unasnwered.  Shouldn't the
garbage collector attend all the globals and the
recurse on the internal scm objects during the
trace operation?
regards,
Praveen





Andreas Rottmann <e9926584@student.tuwien.ac.at>
02/12/2003 08:02 PM

 
        To:     D.V. Praveen/Intl/Skyworks@Skymail
        cc:     guile-user@gnu.org@SMTP@Exchange
        Subject:        Re: GC ??

dv.praveen@skyworksinc.com writes:

> hi,
> I am using guile 1.6.0. and programming in C.
> 
> I am using scm_boot_guile and scm_shell in the function
> I pass to scm_boot_guile.  All the SCM objects that are
> created, say using 'scm_make_string', 'scm_make_vector'
> etc, and assigned to globals don't seem to exist after
> call to scm_shell is made.  My code looks something like
> this..
> 
> #include <libguile.h>
> static SCM vector;
> static SCM
> retVec()
> {
>     return vector;
> }
> static void
> CreateVector()
> {
>     vector = scm_make_vector(SCM_MAKINUM(2), SCM_EOL);
> }

use 'vector = scm_permanent_object (scm_make_vector(...'

Regards, Andy
-- 
Andreas Rottmann




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 10+ messages in thread
* GC ??
@ 2003-12-02 11:59 dv.praveen
  2003-12-02 14:32 ` Andreas Rottmann
  0 siblings, 1 reply; 10+ messages in thread
From: dv.praveen @ 2003-12-02 11:59 UTC (permalink / raw)


hi,
I am using guile 1.6.0. and programming in C.

I am using scm_boot_guile and scm_shell in the function
I pass to scm_boot_guile.  All the SCM objects that are
created, say using 'scm_make_string', 'scm_make_vector'
etc, and assigned to globals don't seem to exist after
call to scm_shell is made.  My code looks something like
this..

#include <libguile.h>
static SCM vector;
static SCM
retVec()
{
    return vector;
}
static void
CreateVector()
{
    vector = scm_make_vector(SCM_MAKINUM(2), SCM_EOL);
}
static void innerMain(void *closure,
        int argc,
        char **argv)
{
    CreateVector();
    scm_c_define_gsubr("retVec", 0, 0, 0, retVec);
    scm_shell(argc, argv);
}
main(int argc, char **argv)
{
    scm_boot_guile(argc,argv,innerMain,0);
}

After I built the program, and call (retVec) on the
'guile>' promt, it doesn't return vector
'#(() ())'  Then I tried to create guardian and protect
'vector' but it doesn't work.  As far as I understood
GC, it should not free any global variables.  Am I missing
something in my understanding?  Any suggestion on how to
make this work would be helpful.
BTW, after I create guardian I used gh_call1 to call the
guardian procedure.(depreciated, but I could not figure out
how to call using SCM interface)

regards,
Praveen


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-12-03 17:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-03 12:58 GC ?? dv.praveen
2003-12-03 17:08 ` Matthias Koeppe
     [not found] <200312030720.hB37Khv7022012@smtp1.urprovider.com>
2003-12-03 11:25 ` Andreas Rottmann
  -- strict thread matches above, loose matches on Subject: below --
2003-12-03  7:20 dv.praveen
2003-12-03 10:44 ` Matthias Koeppe
2003-12-03 12:45   ` Stephen Compall
2003-12-03 15:55     ` Ludovic Courtès
2003-12-03 17:04     ` Matthias Koeppe
2003-12-02 11:59 dv.praveen
2003-12-02 14:32 ` Andreas Rottmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).