Re: Max arguments for NSTask?
Re: Max arguments for NSTask?
On Sun, Oct 27, 2002 at 04:14:44PM -0600, Chris Hanson wrote:
>
At 12:53 PM -0600 10/27/02, Nicholas Riley wrote:
>
>This is most likely not a NSTask limitation but a generic command-line
>
>invocation problem. You can use sysctl to retrieve kern.argmax
>
>(CTL_KERN, KERN_ARGMAX in <sys/sysctl.h>). Note that this is a
>
>character limit, not an argument limit; sysctl.h does not make this
>
>very clear.
>
>
What I want to know is why a modern operating system would have such
>
a limitation in the first place.
I don't know of a Unix-derived OS that doesn't have such a limitation.
>
It's not like memory allocation is that hard a problem.
It's a design decision, IMO. The approach of dumping lots of
filenames on the command doesn't scale to thousands of files, because
you have to enumerate them all, potentially filling up megabytes of
memory and holding the whole thing in argv for the duration of the
program's execution. Unix has pipes to facilitate interprocess
communication, and xargs simply functions as a gateway from pipes to
command line arguments, thereby using a lot less memory and resources
than the naive approach of simply making the command line buffer
bounded by memory.
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.