Max length of system.string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Qwert

    Max length of system.string

    Hello,

    is there a max length for a System.String?

    Thanks.


  • Herfried K. Wagner [MVP]

    #2
    Re: Max length of system.string

    "Qwert" <nosp@nosp.co m> schrieb:[color=blue]
    > is there a max length for a System.String?[/color]

    I guess it is ~ 'Int32.MaxValue ', because otherwise properties and methods
    of the 'String' class would not work as expected any more.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • M. Posseth

      #3
      RE: Max length of system.string

      The limit depends only on the amount of memory available.

      so on my windows 2003 64 bit with 1.2 gb of memory and 15 Gb of free
      harddisk space on the disk that contains the swapfile it might be a different
      amount as on yours :-)

      Michel Posseth [MCP]


      "Qwert" wrote:
      [color=blue]
      > Hello,
      >
      > is there a max length for a System.String?
      >
      > Thanks.
      >
      >
      >[/color]

      Comment

      • M. Posseth

        #4
        Re: Max length of system.string


        hmmm ;-)

        that is a good one .....

        guess you are right



        "Herfried K. Wagner [MVP]" wrote:
        [color=blue]
        > "Qwert" <nosp@nosp.co m> schrieb:[color=green]
        > > is there a max length for a System.String?[/color]
        >
        > I guess it is ~ 'Int32.MaxValue ', because otherwise properties and methods
        > of the 'String' class would not work as expected any more.
        >
        > --
        > M S Herfried K. Wagner
        > M V P <URL:http://dotnet.mvps.org/>
        > V B <URL:http://classicvb.org/petition/>
        >
        >[/color]

        Comment

        • M. Posseth

          #5
          Re: Max length of system.string


          found a blog of someone who actually tested this




          also interesting :

          Answers is the place to go to get the answers you need and to ask the questions you want


          wich states that the memory should be the limit


          interesting :-)

          regards

          Michel Posseth [MCP]

          "Herfried K. Wagner [MVP]" wrote:
          [color=blue]
          > "Qwert" <nosp@nosp.co m> schrieb:[color=green]
          > > is there a max length for a System.String?[/color]
          >
          > I guess it is ~ 'Int32.MaxValue ', because otherwise properties and methods
          > of the 'String' class would not work as expected any more.
          >
          > --
          > M S Herfried K. Wagner
          > M V P <URL:http://dotnet.mvps.org/>
          > V B <URL:http://classicvb.org/petition/>
          >
          >[/color]

          Comment

          • Qwert

            #6
            Re: Max length of system.string

            Great, thanks both.

            I tried to create a string with 2.147.483.647 characters, but around
            50.000.000 characters my system can't handle it anymore. That's only 2% of
            it...



            "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
            news:eDAFXP54FH A.3192@TK2MSFTN GP12.phx.gbl...[color=blue]
            > "Qwert" <nosp@nosp.co m> schrieb:[color=green]
            >> is there a max length for a System.String?[/color]
            >
            > I guess it is ~ 'Int32.MaxValue ', because otherwise properties and methods
            > of the 'String' class would not work as expected any more.
            >
            > --
            > M S Herfried K. Wagner
            > M V P <URL:http://dotnet.mvps.org/>
            > V B <URL:http://classicvb.org/petition/>[/color]


            Comment

            • M. Posseth

              #7
              Re: Max length of system.string

              well just as curious as i am i tried when my system couldn`t handle it
              annymore


              Acer 1524 WLMI Laptop ( Desktop replacement )
              AMD 64 3400 +
              Windows Server 2003 X64
              1,2 GB of memory

              running in visual studio 2003

              this is still running
              Dim s As New String("a", 490000000)

              500000000 will raise an error ( out of memorry )

              490.000.000 that is pretty much more as you :-)

              now in Visula studio 2005 in x64 mode

              this is still running

              Dim s As New String("a", 1000000000)

              however this raises the out of memory exception 1100000000


              Looking at my taskmanager i saw hughe memory consumption VM size of 2 GB
              physical memory of 980 MB

              verry interesting as this proves to me that the maxsize of a string is
              limited by

              a : hardware
              b : platform
              C : max size of the integer data type


              it is for sure that you can not ever create a string that is bigger as the
              integer`s maximum size of the data type

              however how the Hardware and platform relate to the maximum creatable size
              is unknown to me , ,,,,,,,,,, interesting


              regards

              Michel Posseth



              "Qwert" wrote:
              [color=blue]
              > Great, thanks both.
              >
              > I tried to create a string with 2.147.483.647 characters, but around
              > 50.000.000 characters my system can't handle it anymore. That's only 2% of
              > it...
              >
              >
              >
              > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
              > news:eDAFXP54FH A.3192@TK2MSFTN GP12.phx.gbl...[color=green]
              > > "Qwert" <nosp@nosp.co m> schrieb:[color=darkred]
              > >> is there a max length for a System.String?[/color]
              > >
              > > I guess it is ~ 'Int32.MaxValue ', because otherwise properties and methods
              > > of the 'String' class would not work as expected any more.
              > >
              > > --
              > > M S Herfried K. Wagner
              > > M V P <URL:http://dotnet.mvps.org/>
              > > V B <URL:http://classicvb.org/petition/>[/color]
              >
              >
              >[/color]

              Comment

              Working...