[fpc-pascal] TProcess stack size
Michael Van Canneyt
michael at freepascal.org
Mon Aug 25 11:33:59 CEST 2014
On Fri, 22 Aug 2014, Frank Poretzky wrote:
> in MS Windows is there a way to increase stack size for an executable
> run through TProcess?
Not that I am aware of.
> For portability reasons I tried to migrate from
> CreateProcess to TProcess, but when executing more complex operations of
> the called program it now aborts due to a memory shortage though simpler
> tasks in the same program run correctly. I've already set the project's
> heap (-Ch) and stack size (-Cs) to high values.
> AProcess.Options := [poUsePipes, poNoConsole];
> AProcess.PipeBufferSize := 2048;
> AProcess.ShowWindow := swoNone;
> AProcess.CurrentDirectory := ExtractFilePath( ExeStr);
> AProcess.Executable := ExeStr;
> AProcess.Parameters.Text := ParStr;
> makes problems whereas with
> CreateProcess( nil,
> PChar( ExeStr + ' ' + ParStr),
> @SecAttribs, nil,
> CREATE_NEW_CONSOLE or CREATE_SEPARATE_WOW_VDM or
the CREATE_SEPARATE_WOW_VDM is something that does not exist in TProcess,
but since it is used to control 16-bit processes, I doubt this is the cause of your problem.
> CREATE_NEW_PROCESS_GROUP or NORMAL_PRIORITY_CLASS,
> PChar( ExtractFilePath( ExeStr)),
> StartInfo, ProcInfo);
> as well as run directly from the commandline it works properly.
Does the program create output ?
If so, are you reading the output from the pipes ? If not, this is most likely your problem.
When the I/O buffers are full, The program will block till you read the output and thus free
the I/O buffers...
More information about the fpc-pascal