• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Max size of an NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Max size of an NSString


  • Subject: Re: Max size of an NSString
  • From: Jörn Salewski <email@hidden>
  • Date: Tue, 28 Oct 2003 17:13:24 +0100

Theoretically the maximum size of an NSString would be determined by the
maximum size of its index to access the single unichar characters; this
index is defined as an unsigned int, so it would be UINT_MAX unichars.

Therefor, on a 32bit machine you could store up to 4GB of characters in an
NSString. Practically, with such a big string the computer would probably
stop responding because of vm swaping.

(serious question:) Has anybody ever tried this?

unichar *ptr = (unichar *)malloc(UINT_MAX * sizeof(unichar));

I think your problem is related to some character in the file (like a
linebrake) that is interpreted as a terminating NULL charater '\n'.

I'd suggest you check the file with a hexeditor where it gets truncated.

Chears,

JS


am 28.10.2003 14:29 Uhr schrieb Arthur VIGAN unter email@hidden:

> What is the mximum size of an NSString?
>
> I am trying to put the content of an HTML file of only 8KB in an
> NSString, but the file is truncated...
>
> -- Arthur
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Max size of an NSString
      • From: "Alastair J.Houghton" <email@hidden>
References: 
 >Max size of an NSString (From: Arthur VIGAN <email@hidden>)

  • Prev by Date: test if a pointer is pointing to a valid object or not?
  • Next by Date: Re: What is this error? [solved]
  • Previous by thread: Max size of an NSString
  • Next by thread: Re: Max size of an NSString
  • Index(es):
    • Date
    • Thread