This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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: Using vfork() in do_system() instead of fork()


On Tuesday 23 June 2009 14:16:02 David Wuertele wrote:
> > Linux implements copy-on-write, therefore after the fork you shouldn't
> > be using any more memory (modulo the new structures allocated by the
> > kernel). Are you actually seeing memory usage double after the fork? I
> > think your problem is elsewhere.
>
> I don't have direct evidence that the memory usage doubles, but system()
> only fails if my app has consumed more than half of physical memory.
>
> One test I did was to write a program that allocates and touches more and
> more memory, while running system() and my replacement of glibc's
> system() that uses vfork() instead of fork().  After the test program
> allocates about half of remaining memory, the standard system() starts
> returning -1, but my vfork() implementation continues to work right up
> until there's really nothing free.

since there's pretty much no chance of do_system() changing, why not use your 
simple wrapper.  the amount of code needed to do vfork+exec on a string is 
pretty small.
-mike

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


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