Re: A problem about programming with gtk+ in multiprocess.



On Mon, 2001-12-17 at 02:14, Jean-Christophe Berthon wrote:
    Hy,
    
    Is it possible so to free the memory of the child process of any Gtk
    library? Has the memory is duplicate, this can be rather interesting to save
    a bit of it...
    Thanks,

Hi Jean-Christophe,

Freeing memory in the child process is not normally necessary since most
kernels (including Linux) employ the "copy on write" policy for the
child process address spaces.  This means that the memory actually isn't
copied from parent to child unless either process makes changes to the
memory, otherwise the child just reads directly from the parent process.

Hope that helps, 

Rusty
    
    
    Best regards,
    ---
    Jean-Christophe Berthon
    
    
    ----- Original Message -----
    From: "Paul Davis" <pbd Op Net>
    To: <raise_sail sina com>
    Cc: <gtk-list gnome org>
    Sent: Sunday, December 16, 2001 5:45 PM
    Subject: Re: A problem about programming with gtk+ in multiprocess.
    
    
    > >hello all,
    > >I have a problem when programming with gtk+ in multiprocess.
    > >please look follow codes :
    >
    > what is is that has made some people think that this "fork, then have
    > the parent and the child continue to use GTK+" will work?
    >
    > you cannot do this (reliably). X Window is inherently multithread
    > safe, and since the child and parent both share the same connection to
    > X server, using fork() rather than pthread_create() is just a detail
    > that doesn't really change what is going on: two contexts of execution
    > making parallel, unsynchronized requests to the X server on the same
    > connection.
    >
    > we need to make it more clear that after fork(2), the child should never
    > access GTK structures or functions unless the parent never does so
    > again. can we add something to the FAQ about this?
    >
    > --p
    > _______________________________________________
    > gtk-list mailing list
    > gtk-list gnome org
    > http://mail.gnome.org/mailman/listinfo/gtk-list
    
    _______________________________________________
    gtk-list mailing list
    gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
    
    

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]