Like Tree7Likes

Changing default stack size with MinGW/GCC?

This is a discussion on Changing default stack size with MinGW/GCC? within the C Programming forums, part of the General Programming Boards category; Ah hell. I realized that I was actually creating a temp copy of the huge var within a function as ...

  1. #16
    Registered User
    Join Date
    Jun 2008
    Posts
    161
    Ah hell. I realized that I was actually creating a temp copy of the huge var within a function as well. That would've been what would cause the overflow. Anyway, it's been reworked substantially.

    Quote Originally Posted by ledow View Post
    The other reason, of course, to not change stack size is that the stack size necessary is then another "hidden" piece of information, that's not in the code, that everyone who compiles it has to replicate. If you don't replicate it, the program will mysteriously crash and you'll have to debug. Whether that's your friend, your tutor, someone on the Internet or even yourself 10 years from now, that's going to cause problems for no good reason.
    Well, it's in the makefile. Second, if you create a thread within the program, then it actually is in the code. Third, the program relies on win32API so it's not getting compiled on anything else for any logical reason.

  2. #17
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    Quote Originally Posted by Viper187 View Post
    Why do I need to screw around using malloc (and free) on an array of structs that's ALWAYS the same size just because it's a little big? With everyone running systems with gigabytes of RAM, why is the stack still defaulted to like 8MB? That's what I want to know. Why add extra coding just to save on a little memory? My thinking has always been that malloc should only be necessary for handling things of dynamic size. Like allocating an array to load some random file that could be any size.
    Simply because that's not what the stack is for.

    It's like saying "why don't we make all vehicles the size of a bus and capable of transporting at least 30 people". It's because that's not what a car is for.
    AndiPersti likes this.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing default font in Emacs
    By dra in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 02-26-2008, 01:53 AM
  2. default stack size on modern Linux?
    By cyberfish in forum C++ Programming
    Replies: 3
    Last Post: 02-03-2008, 05:36 PM
  3. .exe size with MinGW
    By Stabbsy in forum C++ Programming
    Replies: 3
    Last Post: 11-16-2006, 05:07 AM
  4. changing default code in dev c++?
    By 7stud in forum C++ Programming
    Replies: 1
    Last Post: 12-15-2005, 04:06 PM
  5. Changing default unit in BCB 5
    By Mario in forum C++ Programming
    Replies: 0
    Last Post: 05-26-2002, 09:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21