Author Topic: stack size  (Read 36278 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
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: 943
    • TDM-GCC
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.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 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: 9617
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: 9617
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.

Offline Raef Mohamed

  • Single posting newcomer
  • *
  • Posts: 1
Re: stack size
« Reply #10 on: February 05, 2021, 05:52:18 pm »
Hello,
I am trying to increase the stack size
I write in the linker options "-Wl,--stack,2048" but I receive an error unrecognized option '--stack'
Could anyone help?.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: stack size
« Reply #11 on: February 05, 2021, 06:00:49 pm »
1. Are you sure you're giving it to the linker. To verify inspect the full build log
2. Are you sure your linker supports it? To verify inspect the linker's documentation.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline matthen

  • Single posting newcomer
  • *
  • Posts: 1
Re: stack size
« Reply #12 on: June 03, 2021, 06:11:58 pm »
Hello,
I am trying to increase the stack size
I write in the linker options "-Wl,--stack,2048" but I receive an error unrecognized option '--stack'
Could anyone help?.

The string "-Wl,--stack=2048" worked for me. Also, I believe that the units are bytes, rather than megabytes, so it's probably sensible to add a few 0s. (Happy to be proven wrong)

Offline benkenobi01

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: stack size
« Reply #13 on: June 04, 2021, 08:46:35 pm »
Hello,
I am trying to increase the stack size
I write in the linker options "-Wl,--stack,2048" but I receive an error unrecognized option '--stack'
Could anyone help?.
Dude what's your problem?