Live data from Hacker News

Dalvik patch for Facebook for Android

facebook.com

81–90 of 95 posts

Re: Dalvik patch for Facebook for Android

#81
post #27

According to http://techcrunch.com/2013/03/04/facebook-google-dalvik/ and http://venturebeat.com/2013/03/04/google-facebook-android/ , the specific limit being hit was a cap of three million methods per instance of the Dalvik VM. Wisdom of a three-million-method app aside, I wonder why they didn't fix this in the compilation toolchain rather than by poking around in native memory areas during app startup. Facebook wr…

I really can't fathom how, Facebook (the mobile / client app) could be made up of 3 million methods. That's an enormous amount of code -- none of it adds up.

It's probably Thrift. It generates absolutely incredible amounts of code for even relatively small pieces of data. Quite unsuitable for the purpose of mobile dev.

Re: Dalvik patch for Facebook for Android

#82
post #3

It's interesting to see the parallels between Android and Windows in this regard. Here's a story from my past, copied from a blog post I wrote last year: My first job at Microsoft was providing developer support for the early Windows SDKs. To do my job well, I spent hours studying the Windows SDK documentation, the Windows source code, and writing sample applications. I then spent hours poring over customers’ (such a…

Parallels? > I had the WordPerfect engineer on the phone. He had given me access to the WordPerfect source code, but I couldn’t give him access to the Windows code . So we were each stepping through WordPerfect in the debugger, him in Utah and me in Bellevue. I could see what his code was doing and what Windows was doing, but he could only see disassembly for Windows . FTA: Instead, we needed to inject our secondary…

As far as I know Google has not inserted code to deal with backwards compat. Yet.

Re: Dalvik patch for Facebook for Android

#83
post #47
post #3

It's interesting to see the parallels between Android and Windows in this regard. Here's a story from my past, copied from a blog post I wrote last year: My first job at Microsoft was providing developer support for the early Windows SDKs. To do my job well, I spent hours studying the Windows SDK documentation, the Windows source code, and writing sample applications. I then spent hours poring over customers’ (such a…

So? How'd you fix it? Don't stop the story halfway...

My memory of that part isn't so great. :-)

I seem to recall the WP guy just backing out his approach and going another way. Often times in dev support situations like that, we didn't get to help with the solution: Just the identification of the problem.

Re: Dalvik patch for Facebook for Android

#84

According to http://techcrunch.com/2013/03/04/facebook-google-dalvik/ and http://venturebeat.com/2013/03/04/google-facebook-android/ , the specific limit being hit was a cap of three million methods per instance of the Dalvik VM. Wisdom of a three-million-method app aside, I wonder why they didn't fix this in the compilation toolchain rather than by poking around in native memory areas during app startup. Facebook wr…

iirc, one the primary reasons they they wrote the compiler was to not have to deal with legacy php code. Is this some sort of pattern at FB? If the code doesn't work, let's fix the OS/compiler instead?

Re: Dalvik patch for Facebook for Android

#85
post #79
post #20

Earlier quoted context omitted.

Hitting an arbitrary (and undocumented?) platform limit on the number of methods your app is allowed to have is hardly "painting themselves into a corner".

I'm not sure if it is listed in the official documentation but it was talked about by the Android team on their blog: http://android-developers.blogspot.com/2011/07/custom-class-...

This appears to discuss the per-dex method limit but makes no mention of the per-process limit.

Re: Dalvik patch for Facebook for Android

#86
post #3

It's interesting to see the parallels between Android and Windows in this regard. Here's a story from my past, copied from a blog post I wrote last year: My first job at Microsoft was providing developer support for the early Windows SDKs. To do my job well, I spent hours studying the Windows SDK documentation, the Windows source code, and writing sample applications. I then spent hours poring over customers’ (such a…

Parallels? > I had the WordPerfect engineer on the phone. He had given me access to the WordPerfect source code, but I couldn’t give him access to the Windows code . So we were each stepping through WordPerfect in the debugger, him in Utah and me in Bellevue. I could see what his code was doing and what Windows was doing, but he could only see disassembly for Windows . FTA: Instead, we needed to inject our secondary…

I think it's also worth noting that this kind of evil hack is a lot safer when you're only targeting older OS releases. That essentially gives you a fixed target. Changes in a new release won't break your hack, because your hack doesn't apply to new releases anyway. It's still awful, but much less scary.

Re: Dalvik patch for Facebook for Android

#87
post #27

Earlier quoted context omitted.

I really can't fathom how, Facebook (the mobile / client app) could be made up of 3 million methods. That's an enormous amount of code -- none of it adds up.

It's probably Thrift. It generates absolutely incredible amounts of code for even relatively small pieces of data. Quite unsuitable for the purpose of mobile dev.

Thrift isn't used on the mobile apps, it is meant (and used for) communication between different services in their backend.

Re: Dalvik patch for Facebook for Android

#89

Uninstalled. I checked, and Facebook took up more memory than any other application I have installed, even more than TSF Shell. (By the way, a MUCH more "feature-rich," useful, and snappy app than facebook!) Facebook isn't doing anything comparable to what TSF Shell does, not for me anyway. I bet this is why my phone recently started taking 30 seconds to make a phonecall (!). I can't believe an app requires 8M RAM ju…

According to dexdump there are 37,733 methods in 7,188 classes.

Re: Dalvik patch for Facebook for Android

#90

Earlier quoted context omitted.

What if Y is closed-source? What if source for Y is not available for some other reason? What if your patch breaks Y's behavior on other platforms?

>What if Y is closed-source? What if source for Y is not available for some other reason? What if your patch breaks Y's behavior on other platforms? Advantages of open source may not apply to closed source.

OK, let me elaborate.

Unless you believe all software must be open source ( which is hopelessly unrealistic ) the question becomes how we can bring about most openness. Surely, closed software on an open platform is better than open software on a closed platform? But to do stuff like this takes a lot of resources. Group of volunteers may not have the resources to do so on their spare time. So we may all be better off because we have good engineers highly paid and with lots of resources to work on such an important platform as the OS.

TL;DR: Reading the comment fully recommended before snarking.

Post reply on HN