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

Re: [MiNT] Freeing child's base page



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.

--
Vincent Rivière