• 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: Memory limitation of NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory limitation of NSScrollView


  • Subject: Re: Memory limitation of NSScrollView
  • From: Art Isbell <email@hidden>
  • Date: Thu, 26 Jul 2001 10:09:30 -1000

On Thursday, July 26, 2001, at 03:16 AM, Christian Mike wrote:

In Max OS 9 and Windows NT, I must keep track of the size of
the buffer that contains the "contents" of the command window.

This seems to be typical of Win32 and I guess Mac OS. There are just so many resource limitations, mostly due to poor implementation. There's no reason why these implementations couldn't automatically dynamically increase a buffer size when it nears being full. This is the approach used in most Objective-C classes.

I always hated using Windows Command Prompt because it didn't have a scrollback buffer by default. You could set the scrollback buffer size, but "unlimited" wasn't a choice. And when a scrollback buffer was set, the entire buffer was allocated so that the Command Prompt window could be scrolled to the bottom even though no text existed there. What a LAME implementation.

Compare that to OS X Terminal.

1.) If I create an NSScrollView in IB and start throwing text into it, how
big is the default buffer before it fills up and won't accept any more?

NSScrollView's don't contain text, they contain views. You'll probably make a NSTextView your NSScrollView's documentView. In IB, this is all preconfigured.

There's no default buffer size for NSTextView. Terminal probably uses a NSTextView. I've had terminal sessions that lasted weeks never running out of scrollback buffer. If I had examined the amount of memory being used by Terminal, I would have noticed the scrollback buffer memory being used.

2.) If it will grow automatically to an unlimited size, should I put some
artificial limit (say 2MB) on the size and start throwing out the oldest
stuff so that it doesn't hog memory?

That's a design decision on your part. I hate to limit what an end-user can do if I can avoid it. If you discard some initial text, some users will probably be irritated that they can no longer view that text. Maybe you should consider Terminal's approach and make NSTextView buffer size a user preference.

3.) In Windows NT, I programmatically select the oldest text in the window
(usually scrolled off the top) and delete (cut) it. Will that same approach
work here, or should I do something different?

You might look at NSTextView's replaceCharactersInRange:withString: (inherited from NSText).

Art Isbell
Apple iServices Technical Support
http://www.apple.com/iservices/webobjectssupport/
+1-808-591-0836


  • Prev by Date: Re: Objective-C vs. Java
  • Next by Date: Discovering Openstep Tutorial (missing code)
  • Previous by thread: Re: Memory limitation of NSScrollView
  • Next by thread: how to sort an array descending
  • Index(es):
    • Date
    • Thread