Announcement

Collapse
No announcement yet.

Longest an ASCIIZ String Can Be?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    If you want a LOCAL large ASCIIZ string, you can:

    Code:
    FUNCTION Foo
    
      REDIM szFoo(0) AS ASCIIZ * 2000000
    
    END FUNCTION
    For arrays it seems only the descriptor comes out of the stack and the dataspace comes out of the far heap (i.e., the GlobalAlloc family)

    MCM

    Leave a comment:


  • Semen Matusovski
    replied
    It's necessary to make dynamic string.
    For most operations (=, Mid$ and so on) long Asciiz are bad, because PB searches 0.

    ------------------
    E-MAIL: [email protected]

    Leave a comment:


  • Peter Scheutz
    replied
    Originally posted by Steve Hutchesson:
    Following from the technical data that Lance has provided, if you
    do use a GLOBAL or STATIC ASCIIZ string, your program will increase
    in size by the amount that you allocate that way.
    I wanted to test this, so I made the following program:
    Code:
    #Compile Exe
     
    Global bigString As Asciiz*16777216
     
    Function PbMain()
        MsgBox "HI"
    End Function
    Steve seems to be correct on this.
    Mem usage grows to 17 Mb.
    Filesize is 5.0 KB

    PS: using any number larger than 16777216, gives a "Integer constant expected" error from the compiler (PB6)


    ------------------
    Best Regards
    Peter Scheutz

    [This message has been edited by Peter Scheutz (edited August 08, 2001).]

    Leave a comment:


  • Steve Hutchesson
    replied
    Following from the technical data that Lance has provided, if you
    do use a GLOBAL or STATIC ASCIIZ string, your program will increase
    in size by the amount that you allocate that way.

    Unless you have a very good reason to do that, I would be inclined
    to work with dynamic string or GlobalAlloc() style memory as it
    does not blow out the size of your EXE file.

    The BYCOPY operator in PowerBASIC allows you to use basic dynamic
    string where an API call requires a string address so I would be
    inclined to look for another way to do what you are after.

    Regards,

    [email protected]

    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    LOCAL scalar (non-array) variables are created within the stack frame, which limits them to below 1Mb (except dynamic strings because only the handle is stored on the stack). To create larger ASCIIZ or fixed-length strings, make them GLOBAL or STATIC.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Scott Slater
    started a topic Longest an ASCIIZ String Can Be?

    Longest an ASCIIZ String Can Be?

    What is the longest that an Asciiz string can be? I was trying to
    create a 1 megabyte Asciiz string and it causes a Stack fault in
    Windows. The most I can make it is around 200 KB. Anyone have any
    info on this?


    Scott


    ------------------
Working...
X