Why does NSColorPanel accumulate memory usage? Try it:
- Create a brand new cocoa-based application in Xcode
- add a sinlge NSColorWell to the main window
- Run app and open a memory monitor (ex. Activity Monitor)
- Click the 开发者_如何学Ccolour well to bring up the NSColourPanel
- Click and drag your mouse on the colour wheel, twirling it around and around for a while, watching the app's memory usage
Result: Memory keeps climbing, slowly but surely (4-5Mb's in about a minute). In my tests, it seems to hit some sort of barrier after climbing about 4 megs, after which it stays somewhat steady, or climbs more slowly. And this is with garbage collection turned on. With it turned off, there seems to be no barrier; memory usage keeps climbing steadily.
This isn't a huge deal, practically-speaking. But it bothers me. I want to know what is going on with the memory, if such "leaks" (?) occur in other standard gui objects the developer may have no fine control over, and if this is just a gap in my understanding of how things work.
The only thing I can think of is perhaps the app is storing a history of selected colours for whatever reason (and this history keeps growing), but this seems unlikely to me.
File it at bugreport.apple.com.
精彩评论