CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2003
    Posts
    27

    about stack size

    If my programm needs exact 600 bytes stack, can I just allocate 600 bytes for it? Will this causes stack overflow? Or some other problems?
    Thank you in advance.

  2. #2
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Either I am missing something here or I do not understood the problem...yes, you can allocate 600 bytes on the stack...without any problems...

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: about stack size

    Originally posted by wind0965
    If my programm needs exact 600 bytes stack, can I just allocate 600 bytes for it? Will this causes stack overflow? Or some other problems?
    Thank you in advance.
    So what would happen if there are 601 bytes? Or for that matter 599 bytes? In other words, what exactly are you trying to accomplish?

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,210
    I think wind0965 wants to adjust the stack space that windows allocates to fit exactly the 600 bytes to reduce memory waste..
    maybe the /STACK compile option can help.

  5. #5
    Join Date
    Nov 2003
    Posts
    27
    well, I don't know if it is necessary to reserve some more bytes for the interrupts or something else. The 600 bytes I mentioned is exactly my program itself needs.

  6. #6
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by wind0965
    The 600 bytes I mentioned is exactly my program itself needs.
    It is dangerous to assume that. For example, if the application gets an error, it could need more stack space and when it is not available, the application would crash in a manner that an application should never crash. You should endeavor to prevent crashes such as that, not cause them.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  7. #7
    Join Date
    Nov 2003
    Posts
    27
    But how many more bytes of stack do I need for one application to avoid the crash? If there are some methods or mechanisms to estimate it?
    Thank you for the reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured