Reducing memory fragmentation in GNOME
Firefox 3 has undergone a lot of work to reduce memory fragmentation and the number of heap allocations, with great results. GNOME needs the same kind of analysis. This will help us reduce the base memory footprint of long-running applications, and possibly their maximum memory footprint as well.
During the lifetime of a process, it allocates and deallocates things from the heap with malloc()/free(). Naturally, these allocations and deallocations happen in semi-random order, and the heap becomes fragmented. Even though the heap may have enough free space for a new allocation request, that space may not be contiguous. So, the program will need to grow the heap, requesting new memory pages from the kernel, to satisfy this request.
- Investigate the tools that Firefox used to analyze memory fragmentation.
- Run these tools on a few well-known GNOME programs: Nautilus, Evolution, Pidgin.
- Get graphs on the number allocations for common operations: opening a Nautilus window, opening a calendar in Evolution, etc.
- Identify the places in the code that have the largest number of allocations.
- See how to reduce the number of allocations in those places: by using stack buffers, different allocation strategies, introducing new APIs, etc.
- At the end, produce a report with your findings and your patches.
You need to be very familiar with C coding.
You need to be moderately familiar with low-level tools like Valgrind, glibc's hooks, d-trace, etc.
You'll have to use plotting tools like gnuplot (or hand-build tools) to produce charts of allocations.
Experience with profiling applications is desirable.