Quick log of memory investigations for the day:
Static Linking
It turns out that several of our modules are not currently statically linked. This means there are a bunch of optimizations linkers can't do, and a bunch of strings that are necessarily put into programs that link against those dlls that can't be stripped. On a tiny platform (which is a big reason to be concerned about bloat) you're not going to need those libs to be shared.
Fragmentation
Turning off frame arenas (by defining DEBUG_TRACEMALLOC_FRAMEARENA) doesn't seem to keep fragmentation down much. But now that I think more seriously about how an OS would do memory allocation, I think I understand why that would be. At least if pagesize is small, frame arenas should actually keep fragmentation down. In fact, as I write this I begin to question whether the numbers we have been reading for the amount of size the app takes up are accurate--the VmSize of GtkEmbed was up to 29M with an apparent 10Mb of fragmentation, and the size reported in top was 17-19M (I forget which). Therefore it would seem that that number is not reported, when it really needs to be for a small target. Or is this a red herring? Maybe what you'd do to kill fragmentation problems on a small device is just set pagesize frighteningly small. I need to investigate this.
I learned how /proc/*/maps works today (tells you what dll has what memory allocated for it), so it's time to start correlating those results with trace-malloc and see what kind of objects are left around in mostly-empty pages and where they are left around. It's my theory (perhaps wrong) that a ton of objects are created when you load a document and some of those objects are kept around for the next document (caches and the like). For a small target, they shouldn't be.
Hard Size Limits (Memory Pressure)
Another really interesting idea to come out of today's myriad discussions was to have a pref to enforce a "pretty hard limit" on our size. In other words, when we get near that limit (say within 200K?), documents will stop creating content nodes and frame construction will abruptly halt. We can't do anything about people creating new strings, but I'm sure. This pref will help us develop to smaller targets and, as Kevin points out, some users might want it on their machines anyway. The trick is to make sure we don't leak, because that would get ugly with such a pref.
Events
On an unrelated note, I found the problem with events: it relates directly to the fact that we do not store the event target in the event. But shocker of shockers, fixing the problem causes more, eviler problems in events which seem to be related to the same root cause (storing the event target in all sorts of hairy places). I'm investigating, but I begin to suspect we may have to back out the mouse events patch and fix targets to be stored in the event itself (where it should have been all along!) in 1.4alpha.
Posted by jkeiser at February 6, 2003 8:30 PMBut limit your animations to whatever is required to communicate the necessary information. Avoid annoying animations that discourage ease of use. Ask yourself, "What do I need to show the user, and what is the cleanest way possible to achieve that?" A good example is the Mail application for Mac OS X. Whenever a new message arrives, the Dock icon changes appearance to indicate a changed state.
Posted by: Georgette at January 26, 2004 5:39 AMDrawers. Similar to Sheets, this is a "child" window that gives users access to items that do not always need to be present. But when do you use a drawer and when do you use a palette?
Posted by: Salamon at January 26, 2004 5:39 AMSo far in these articles, I have only dipped a toe or two into Aqua's pool. I have covered basic aspects of building an Aqua-compliant application, including the building of photo-illustrative/3D application icons. Now it's time to address other components of our Mac OS X application.
Posted by: Francis at January 26, 2004 5:39 AMNot quite as entertaining as Shrek, but Dock animation can be an important and useful function in your application. For example, Dock animation is a helpful way to indicate the status of your application.
Posted by: Rebecca at January 26, 2004 5:39 AMAdhere to Layout Guidelines. Did you leave 12 pixels between your push buttons? Does the positioning of your pop-up menus make sense, and when do you use a pop-up versus a scrolling list? Are you using the right types of buttons for the proper functions?
Posted by: Benedict at January 26, 2004 5:39 AMDue to the positioning of the Dock, remember that when you build an application, you have to be sure that new document window sizes and positions do not violate the Dock's space. Dock is temperamental and Dock loves his space. If you default to a window size that expands behind the dock, users will have a difficult time reaching the navigation and resize areas at the bottom of the screen. I can personally say that more than once I have been rather peeved that I couldn't get to an area of the window to resize because the default window settings always pop up behind the Dock. In addition, the new Dock in 10.1 will allow users to position their Dock location on either side of the screen as well.
Posted by: Gerrard at January 26, 2004 5:39 AMYou Must Promise. To call your mother, to help old ladies cross the road, and to turn your cell phone off at the movies.
Posted by: John at January 26, 2004 5:39 AMAdhere to System Appearance. Does your application use all the sweetly colored buttons, delightfully shaded windows, and all the other "bells and whistles?"
Posted by: Dionise at January 26, 2004 5:39 AMAdhere to File Locations. Make sure that when your users save documents, your application knows where to put them and also gives users flexibility.
Posted by: Josias at January 26, 2004 5:40 AMUser Assistance. This is helping the user with the proper "next step" when performing a task. Less guesswork for the user on what to do next makes for a better experience.
Posted by: Pompey at January 26, 2004 5:40 AM