Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

How Facebook engineers conquer elusive app memory leaks

Joab Jackson | Aug. 25, 2015
They've learned that it's best not to be so fussy when asking for memory from the operating system.

Instead, what seemed to help lower the crash rate was to make few changes in the amount of allotted memory. The app would ask for all the memory it needed when it started, then try to work within these confines.

This approach alone reduced program crashes by about 30 percent.

Apple provided some additional help in memory allocation as well. In version 8 of iOS, it provided a new programming class called WKWebView, which offloads the viewing of Web pages as a separate process.

The Facebook team also used a number of internally developed tools to detect potential memory errors.

One was a scanning tool developed by Facebook internally and released as open source, called CT-Scan infrastructure, which was originally developed for tuning the performance of mobile apps. It turned out to be effective for pinpointing memory leaks as well.

The team also developed a new in-app memory profiler, which tracked all the memory allocations made by the program, without adding overhead to the program itself. This allows Facebook to collect operational characteristics of a test copy of the program as it is running.

As the program gets updated, the team can compare the amount of memory allocated by different processes, between the new version and older versions. A giant discrepancy between the two may point to a heretofore undiscovered memory leak.

 

Previous Page  1  2 

Sign up for CIO Asia eNewsletters.