Jump to content

Maximum STRING length


bluevw
 Share

Recommended Posts

I'd say as much as the filesystem can retain in a single file, but it kinda depends on where the characters come from.

UNIX

while true; do echo "a" >> file ; done

WINDOWS

for /L %%n in (1,0,10) do ( echo "a" >> file )

To clarify that for loop, we're looping from 1 to 10 with an increment of 0, meaning an endless loop. Note that it may be VERY hard to break this loop, I haven't tried it myself but I've seen warnings.

If you want it to happen FAST then instead of appending a single character, append the contents of the file to itself using cat(UNIX) or type(WINDOWS). Has to be in a loop still, but you'll quickly only be limited by the speed the disk can write the data to the file.

Edited by cooper
Link to comment
Share on other sites

I would think a string exist in ram. When ram is maxed out then you will discover the break point...

BUFF=""

100,000,000.times do |x|

BUFF<<x

Puts BUFF.size

# puts the buff size

# buffer will grow by one, until the buffer is maxed out.

End

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...