Facebook Open-Sources Infer To Help Developers Identify Bugs Before They’re Shipped

Next Story

Uber Creates A Mobile Game To Help Drivers Navigate San Francisco 

Facebook today announced that it is open sourcing Infer, a static program analyzer the company uses to find bugs in mobile code before it’s shipped. Internally, the company uses this tool to analyze the Facebook apps for Android and iOS, Facebook Messenger, Instagram and others.

Facebook says that Infer helps it find hundreds of potential bugs every month by scanning code for issues like null pointer access, as well as resource and memory leaks — the kinds of issues that can easily cause app crashes.

fbinfer

Facebook is obviously known for shipping code as fast as it can. While it can fix bugs on the web just as fast as it releases code, though, that’s simply not an option with mobile apps where users — for the most part — have to download an update to get the fix.

While Facebook mostly uses Infer to look at Android Java Code and iOS Objective-C projects, there is no reason why developers couldn’t use the same tool to also look at any other C and Java code. Indeed, Facebook says it’s also looking at expanding the places (and maybe languages) where Infer can be used.

At Facebook, Infer runs automatically whenever a developer checks in code modifications to the source code of one of the company’s main apps, and the tool then writes comments into the code when it finds issues.

You can read about all of the technical details of how this tool works in Facebook’s blog post, but it’s worth mentioning that Infer uses a concept called “separation logic” to find these issues. That has nothing to do with conscious uncoupling. It’s a theory that allows the analyzer to look at small parts of the application storage instead of the whole application. Using this, Infer can analyze most code changes in under 10 minutes. To speed things up even more, Infer also only looks at the parts of the code that have changed between runs. Without these techniques, this kind of static analysis would be almost impossible.

Infer is now available here.

Featured Image: Barney Moss/Flickr UNDER A CC BY 2.0 LICENSE