Author Topic: stack size  (Read 25354 times)

Offline solar_max

  • Single posting newcomer
  • *
  • Posts: 6
stack size
« on: January 02, 2008, 02:18:09 am »
Hello,

I try to increase the reserved stack size of my output .exe ! I use Code::Blocks on Windows with the MingW compiler. Can I set a variable ?

Thanks for help !

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: stack size
« Reply #1 on: January 02, 2008, 11:52:00 am »
Code: [Select]
D:\desktop>ld --help |grep stack
  --stack <size>                     Set size of the initial stack
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline solar_max

  • Single posting newcomer
  • *
  • Posts: 6
Re: stack size
« Reply #2 on: January 02, 2008, 10:19:40 pm »
Thanks !

Ok for cmd line, but can I configure this in CodeBlocks ? It will be easier if I haven't to go through the cmd line before each run in CodeBlocks ...

Offline Maciek

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: stack size
« Reply #3 on: January 02, 2008, 10:55:55 pm »
project->build options->linker settings->other linker options

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: stack size
« Reply #4 on: January 03, 2008, 06:10:22 am »
project->build options->linker settings->other linker options
... and make sure to tack "-Wl," on the beginning -- i.e. "-Wl,--stack=1024", or whatever you choose for your stack size.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

Offline hokselato

  • Single posting newcomer
  • *
  • Posts: 2
Re: stack size
« Reply #5 on: May 13, 2012, 05:38:14 pm »
Hi all,

Trying to increase stack size for example with "-Wl --stack,1024" from linker or compiler options in Code Block didn't work for me. Is anyone know solution of this problem by using IDE?

Thanks.
« Last Edit: May 13, 2012, 05:52:01 pm by hokselato »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: stack size
« Reply #6 on: May 13, 2012, 08:58:38 pm »
for example with "-Wl --stack,1024"
That is wrong. Instead of "-Wl --stack,1024", use "-Wl,--stack,1024" (notice the comma).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline hokselato

  • Single posting newcomer
  • *
  • Posts: 2
Re: stack size
« Reply #7 on: May 14, 2012, 08:57:44 am »
Thanks for reply,

Sorry for typo. I tried your suggestion but at compile time a blue warnings says unused linker option and end of compile this message disappears. This option is not working. Do you have any alternate advice to increase stack size? I will use my code at an embedded platform so I dont want to use malloc. All my memory allocations must be at stack.

My linker option is (and I also tried it  as compiler option)

-Wl,--stack,52800000

Compiler Warning is;

Compiling: FFT_anysize.c
mingw32-gcc.exe: --stack: linker input file unused because linking not done
mingw32-gcc.exe: 528000000: linker input file unused because linking not done

Thanks.
« Last Edit: May 14, 2012, 09:02:55 am by hokselato »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9493
Re: stack size
« Reply #8 on: May 14, 2012, 09:51:27 am »
Compiler Warning is;
Why don't you simply look up, for example here:
http://sourceware.org/binutils/docs-2.16/ld/Options.html
?
This is a Code::Blocks, not a compiler/linker related forum. You should better ask this question in a forum related to the compiler you are using, e.g. GCC mailing list. It may heavily depend on the platform and version you are using - and for such stuff, you should better ask compiler people, see here:
Quote
--stack reserve
--stack reserve,commit
    Specify the amount of memory to reserve (and optionally commit) to be used as stack for this program. The default is 2Mb reserved, 4K committed. [This option is specific to the i386 PE targeted port of the linker]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline venom4u31

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: stack size
« Reply #9 on: October 01, 2013, 09:19:03 am »
An advice for this action would be to also rebuild the program (Build->Rebuild).
I tried typing "-Wl --stack,1024" and after I have rebuilt the program, the stack size was indeed changed.