[fpc-pascal] TProcess stack size

Frank Poretzky poretzky at nym.mixmin.net
Fri Aug 22 05:05:04 CEST 2014


Hi,

in MS Windows is there a way to increase stack size for an executable
run through TProcess? 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;
  AProcess.Execute;

makes problems whereas with

  CreateProcess( nil,
                 PChar( ExeStr + ' ' + ParStr),
                 @SecAttribs, nil,
                 true,
                 CREATE_NEW_CONSOLE or CREATE_SEPARATE_WOW_VDM or
                 CREATE_NEW_PROCESS_GROUP or NORMAL_PRIORITY_CLASS,
                 nil,
                 PChar( ExtractFilePath( ExeStr)),
                 StartInfo, ProcInfo);

as well as run directly from the commandline it works properly.

(fpc 2.7.1 svn trunk rev. 28506 - i386-win23-win32/win64)

Thanks

Frank



More information about the fpc-pascal mailing list