News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

stack size

Started by solar_max, January 02, 2008, 02:18:09 AM

Previous topic - Next topic

solar_max

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 !

thomas

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."

solar_max

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 ...

Maciek

project->build options->linker settings->other linker options

TDragon

Quote from: Maciek on January 02, 2008, 10:55:55 PM
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.
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

hokselato

#5
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.

MortenMacFly

Quote from: hokselato on May 13, 2012, 05:38:14 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

hokselato

#7
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.

MortenMacFly

Quote from: hokselato on May 14, 2012, 08:57:44 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

venom4u31

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.

Raef Mohamed

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?.

oBFusCATed

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!]

matthen

Quote from: Raef Mohamed 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?.

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)