NSLayoutManager hangs, consumes GBs of RAM when showsControlCharacters set YES
| Originator: | jalkut | ||
| Number: | rdar://18825135 | Date Originated: | 30 Oct 2014 |
| Status: | Open | Resolved: | |
| Product: | Mac OS X | Product Version: | 10.10 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: The presence of certain characters in a text view's text storage will cause NSLayoutManager to hang and consume massive amounts of memory when -[NSLayoutManager showsControlCharacters] is YES. This affects my shipping application, MarsEdit, which uses the showsControlCharacters option for its NSTextView to mitigate the chances of users accidentally sending garbage characters to their blog server. The specific character that I've observed causing trouble is 0xC29D "OPERATING SYSTEM COMMAND" but the problem may extend to other characters. In my tests it requires a number of these characters, possibly in conjunction with other characters. I'm attaching a concise test case in which a xib's NSTextView has been populated with a suitable string to reproduce the bug, and the only line of code added is to setShowsControlCharacters:YES on the text view's layout manager. Steps to Reproduce: 1. Open the attached sample project. 2. Build and run. 3. Resize the window if for some reason it doesn't start hanging immediately. The hang is correlated with the presence of these debug logs in the console: _NSGlyphTreeInsertGlyphs glyph index issue 2 Expected Results: Actual Results: Version: 10.10 (14A388a) Notes: Configuration: Attachments: 'ControlCharacterHang.zip' was successfully uploaded. For Open Radar, the attachment is available here: http://punkitup.com/bugs/ControlCharacterHang.zip
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!