Thread: Heap limit error???

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    32

    Question Heap limit error???

    When compiling a my script I get the following error:

    c:\program files\microsoft visual studio\vc98\include\ostream(286) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit

    The compiler I am using is MicroSoft Visual 6.0 standard edition

    when I double click the error message and go to the line of error in question it appears to take me to the ostream header file, and I am lost at that point.......

    Anyone have any clues as to how I can increase this heap limit...???
    I'd like to put Murphy and his laws in headlock sometimes!

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    does your program have a recursive function or a container (array, list, whatever) with a large number of elements?

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    also, are you including any of your own .h files? if so, make sure you are using #ifndef, #define, and #endif so the files only get included once.

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    32

    heap error

    Yes, the code uses a input from file to using an array of strings to do comparisons. The code is quite lengthy. I initially tried creating a header file to put my variances in of repedive code there and not make my source code look so chaotic, but when it failed with the heap error, I moved it to simple function calls within the same workspace. this returned the same error. I was able to get around the error by commenting out the last function I call. Apparently I created a few lines of code to many and it is not happy with my inefficient - repeditive code.....

    Oh by the way elad... I finally got my looping problem fixed, I took your suggestion and went back to psuedo and was able to fix my logic errors, with the aid of what you said about how the eof is being read to terminate my loop. I still used fin>>ws; which referrs to eat up all "white spaces" outside my loops to force the eof bit on once there was no more data. But your comments on eof and how it worked are what made that possible - thanks-
    I'd like to put Murphy and his laws in headlock sometimes!

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    32

    Exclamation interesting

    I am using my .h file, but I am quite new to that, so I will reseach the #endif #ifndef and #define I'm not sure what they do so I need to read up on that, thanks for the tip, I'll start reading....
    I'd like to put Murphy and his laws in headlock sometimes!

  6. #6
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    here's a quick example. say you have a .h file that gets included by more than one of your other files. you dont actually want that file compiled into your program more than once so you do the following to prevent it.

    Code:
    #ifndef MYFILE_H
    #define MYFILE_H
    
    // all your code goes here
    
    
    #endif
    that way when it gets included the first time, MYFILE_H gets defined, the next time the compiler encounters #include "myfile.h", it knows that MYFILE_H is defined and the file does not need to be included again.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    32

    Thumbs up rock on thanks

    I just went through 3 different intro books and not one had a good example for me, that helps explain what I read, thanks again
    I'd like to put Murphy and his laws in headlock sometimes!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM