limit on cout

This is a discussion on limit on cout within the C++ Programming forums, part of the General Programming Boards category; I have been coding a text game for some time now and I have finally reached the point that my ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    38

    limit on cout

    I have been coding a text game for some time now and I have finally reached the point that my compiler gives the

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

    How do I get around this?


  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Maybe there is some data in the game that can be stored externally, ie, in data files. Otherwise you could do as they say, and increase the heap limit. By default I think it is set at large, which is /Zl. Probably you can specify extra large somehow. Read the compiler documentation for more info.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    38
    Actually I only have what the player needs to see In cout statements... All the rest is in txt files already =/.

    /Zm will fix the probelm but when done the compiler will not accept the functions from the iostream header file. Ideas anyone?
    Last edited by CSoFun; 01-24-2003 at 09:16 PM.

  4. #4
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    How large are your cout statements? Post some code.

  5. #5
    Registered User
    Join Date
    Jan 2003
    Posts
    38
    post code... its a 4500 line program currently and the couts are everywhere.... I don't mind sending the code out tho....

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I think Eibro thinks what I'm thinking now. Do any cout statements display lines and lines of text? Splitting it up into separate statements could fix that.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  7. #7
    Registered User
    Join Date
    Jan 2003
    Posts
    38
    Display lines and lines of text? I have couts that give some storyline for the play to follow... and also some which display their weapons ... if you want a copy of the cpp I will send it to yea... but warning its 4500 lines and a pain to read or even scan...

  8. #8
    Registered User
    Join Date
    Sep 2002
    Posts
    272
    > but warning its 4500 lines and a pain to read<

    Perhaps you should be looking at a different project then. Who cares about cout?
    Joe

  9. #9
    Registered User
    Join Date
    Jan 2003
    Posts
    38
    Ok then what do I use to output strings of data to a console ?

  10. #10
    Registered User
    Join Date
    Sep 2002
    Posts
    272
    Read up on your /Zm compiler switch.

    Teh answer is in the question, grasshopper.
    Joe

  11. #11
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    Posts
    279
    most likely you need to "flush" the buffers more often, if you are using '\n' for the new line, replace them with 'endl'

    each compiler gives you an option of allocating more memory on the heap when it is required, look up information on "malloc"

    Warning: That falls under a category of "dynamic memory management" which isn't an easy topic, and it requires quite a bit of practice...


    good luck

    ..................
    matheo917

  12. #12
    Registered User
    Join Date
    Sep 2002
    Posts
    272
    each compiler gives you an option of allocating more memory on the heap when it is required, look up information on "malloc"
    malloc probably isn't going to help if you're overflowing the CRT heaps. I'd ignore this.
    Joe

  13. #13
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Attach the code, I'll read it. I think mattheo is right, you may need to flush buffers more often, so that you're not sending huge strings to the output stream, that dont get deleted for ages.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  14. #14
    Registered User
    Join Date
    Jan 2003
    Posts
    38
    I truely can't post it here.... that would be mean and such.... I dont have an e-mail of yours that I can attach a file to either... if you want ill go free up my yahoo e-mail.... meanguy76012@yahoo.com send me a e-mail and ill send you the code.

  15. #15
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Check my signature.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

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

Similar Threads

  1. class methods to cout stream
    By shintaro in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2008, 07:27 PM
  2. Need help with program.
    By olgirl4life in forum C++ Programming
    Replies: 3
    Last Post: 12-11-2006, 11:06 PM
  3. Replies: 3
    Last Post: 01-08-2004, 09:43 PM
  4. c++ string input
    By R.Stiltskin in forum C++ Programming
    Replies: 4
    Last Post: 02-22-2003, 04:25 PM
  5. FAQ cout
    By evilmonkey in forum FAQ Board
    Replies: 1
    Last Post: 10-07-2001, 12:32 PM

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