Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Stack overflow

Stack overflow

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maynka
    wrote on last edited by
    #1

    I am using a two dimensional array to read the image data.If i increase the indexes to large value >500 i am getting Unhandled exception:stack overflow.How to overcome this problem. Regards

    C S 2 Replies Last reply
    0
    • M Maynka

      I am using a two dimensional array to read the image data.If i increase the indexes to large value >500 i am getting Unhandled exception:stack overflow.How to overcome this problem. Regards

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Some code and more detailed informations would be welcome.


      Cédric Moonen Software developer
      Charting control [v1.2]

      1 Reply Last reply
      0
      • M Maynka

        I am using a two dimensional array to read the image data.If i increase the indexes to large value >500 i am getting Unhandled exception:stack overflow.How to overcome this problem. Regards

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        Firstly, show some details or you have little hope of getting help. I would guess you're storing the array on the stack; if it's a really big array the heap is the correct choice. Let’s do some calculations. Assume a 2D array of ints with each dimension set to 500. The space required is: sizeof(int)*500*500 = 4*500*500 = 1,000,000. That’s nearly a megabyte on the stack! The default stack size used by the linker is 1 MB. If I’m correct nearly all your stack is being used by one variable!

        Steve

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups