mozilla-b2g/gaia — pull request #8693 by jmcanterafonseca (2013-03-17 19:02:42+00:00)
Title: Bug 849186 - [Buri] Failed to import above 1000 FB friends at one time

This patch implements several memory saving actions:

* Avoid fb.Contact unneeded instantiations
* Avoid Array.slice calls that create more objects
* Smaller chunk size for importing
* helps GC by cleaning unneeded objects once friends are imported
* requests 'screen' and 'cpu' wake locks to keep the app in foreground thus preventing low memory killer to kill it while importing
* Does not trigger sync in update operations if the number of friends is bigger
than a certain threshold