No announcement yet.

Memory usage

  • Filter
  • Time
  • Show
Clear All
new posts

  • Memory usage

    Hi people,

    There was a post recently that commented on the memory usage of comments.
    I recently ran into something that kinda adds to that post:
    I have a piece of code that's about 490 K as text, compiles to an EXE
    of about 540K. My code was even bigger before so i wrote a little cleanup
    prog that strips comments, leading spaces etc. because the IDE handles 512K text files max.
    Now i found that the cleaned code compiles to an EXE that's 5K smaller than the EXE that
    compiles from the code that has all the spaces and comments in it. Obviously i've checked if
    my cleaner cuts away too much but that's not the case. Can anything be said about the
    influence of comments/spaces on the compiled size?
    The stuff i cut away is: leading spaces, empty lines (carriage return only), comments added
    to a line of code (usage of ' on the same line as the code), comment lines (starting with
    '), $IF 0 - $ENDIF blocks.
    Thanks for anything on this.

  • #2
    Comments, spaces, etc., have no effect on compiled code size. Something else is causing the symptom.

    Best regards,

    Bob Zale
    PowerBASIC Inc.



    • #3
      Here's what i've seen/confirmed:
      - Removal if the text between $IF 0 - $ENDIF saves me 1.5Kb. I've left the actual
      $statements themselves to make sure they don't interfere with the size.
      - removal of a large comment block (200 lines) saves me about 0.5Kb.
      - removal of empty lines saves me about 0.8Kb.
      Now, as i said i have a large chunk of code. I've tested this with smaller
      programs as well and they behave as you stated, no change in size.
      Could this have something to do with the fact that my program currently
      consists of about 12000 lines of code (7 segments)?


      • #4
        If thou dost believeth this devoutly, yea verily thou shouldst submit said code to mailto:[email protected][email protected]</A> , as the support personnel have compilers and the ability to read a directory list. Includeth the version number of thine own compiler.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]


        • #5
          Okay. In that case i consider the matter closed. Let's face it, what the hell
          do i care where the 5Kb comes from as long as it doesn't impair my program.
          I just submitted this in the hope that somebody may find it useful, and to further my
          understanding of the compiler, that's all.
          Anyways, i'm sure this will be addressed in DOS powerbasic version 4.