This pull request dramatically decreases gallery memory usage when there are many images in the gallery by no setting the background-image style of thumbnail elements that are not visible. If there are 1000 images on the phone, I expect this patch to make the gallery process 40mb leaner.
The changes to the gallery app itself are small. The interesting code is in shared/js/visibility_monitor.js which tracks the scrolling list of thumbnails to and calls callbacks when they go on and off screen.
Bug 809782 - remove background-image for offscreen thumbnails
Looks great, cheers david