From mint-bounce@lists.fishpool.fi  Wed Jan 27 14:51:17 2010
X-ME-UUID: 20100127194821117.02D601C004E3@mwinf2701.orange.fr
Date: Wed, 27 Jan 2010 20:48:20 +0100
From: Patrice Mandin <mandin.patrice@orange.fr>
To: mint@lists.fishpool.fi
Subject: Re: [MiNT] Freeing child's base page
Message-Id: <20100127204820.07cbf01c.mandin.patrice@orange.fr>
In-Reply-To: <4B60189C.2000806@freesbee.fr>
References: <c6533ef61001261501l44961b1bh146ba21ed071a6b3@mail.gmail.com>
	<4B5F9E76.7070205@freesbee.fr>
	<c6533ef61001262347j2b4f09bfo23344b290f22c698@mail.gmail.com>
	<4B6010B7.70306@freesbee.fr>
	<c6533ef61001270218q182b589ai603617369aa48f70@mail.gmail.com>
	<4B60189C.2000806@freesbee.fr>
Organization: Chez moi
X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.12; i486-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-to: mint-bounce@lists.fishpool.fi
X-original-sender: mandin.patrice@orange.fr
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by mail.sparemint.org id o0RJpG4q017874

Le Wed, 27 Jan 2010 11:42:36 +0100
Vincent Rivière <vincent.riviere@freesbee.fr> a écrit:

> Miro Kropacek wrote :
> > So, if I understand it correctly, when Pexec() returns (using Pterm or 
> > Pterm0) :
> > 
> > 1. all dynamic memory (using M[x]alloc) is returned back to OS, all 
> > opened files are closed
> 
> In the normal mode PE_LOADGO (0), I think it is true. But I don't know 
> hot it behaves in other modes.
> 
> > 2. its text/data/bss segment is still intact, waiting for our Mfree() 
> > call (and this can be changed by using Pexec (6, ...) but don't want it 
> > of course)
> 
> Probably true in mode PE_LOAD (3).
> 
> > 3. static variables are in data segment, i.e. point 2 applies here, i.e. 
> > we can use it as long as basepage isn't free'd
> 
> Yes, sure.
> 
> >     However, it seems that MiNT handle special executable flags to share
> >     the text segment among several process, but I never tried them as
> >     this is a very specific case.
> > 
> > You mean PE_NOSHARE mode? This is default off, i.e. child's memory is 
> > shared with parent, so no worries here.
> 
> Yes, this flag. But I didn't understand that flag like you. I understood 
> it was about sharing the text segment between several process of the 
> same executable to save the identical RAM. In other words, using the 
> text segment like a shared library (useful for sh and make). I don't 
> know if this is still well supported by the kernel and the binutils.
> However, as you said, this mode is off by default, it is out of topic here.
> 
> Further information from a kernel guru would be welcome here.

Just looking at the compendium, Pexec() on more recent Gemdos versions
support PE_GOTHENFREE (6) which automatically frees child memory when
the child Pterm() itself.

-- 
Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Spécialité: Développement, jeux


