You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Stig Bakken <st...@zedge.net> on 2016/12/09 15:38:19 UTC

Re: Thrift in Android

This is just Android's fundamental architecture, with sandboxed apps
running in separate VMs with one uid/gid per app and so on.

As long as you are using Java code running in separate VMs, there is no way
to share memory like you are describing. To do that you would either have
to run everything in the same VM (meaning it has to be the same app), or
build a shared C++ Thrift library, bridge with JNI and dynamically load
that. But that is a very tricky path to go down, even if you are
controlling the Android OS; you need to consider binary compatibility when
updating every component. You may run into cases where you need to have two
or more versions of the .so library present, which means your memory gains
are decreasing.

My recommendation is to try doing it the straightforward way first, let
proguard and friends do its jobs to optimize the apk, and not consider
doing crazy optimization hacks unless really, really necessary. It may not
be as bad as you seem to think. Maintaining OS-level hacks is very
cumbersome and expensive (see also:
https://media.giphy.com/media/saAZVlxwMPOW4/giphy.gif)

 - Stig


On Wed, Dec 7, 2016 at 11:39 AM, shyamjith kv <sh...@acsiatech.com>
wrote:

> Hi,
>
> We are developing a system with limited hardware configuration which runs
> on
> Android Marshmallow. We have created a server and multiple client
> applications using THRIFT in android. When we checked the installation
> package of each application(both server and clients ), found that each of
> them had thrift library .dex file.
>
> 1.       Does this means that each of these applications has Thrift library
> statically linked ?
>
> 2.       Since each application has separate same .dex files in them,
> wouldn't it incur unnecessary memory in Ram?
>
> 3.       Is there any method to avail thrift library in android such that
> all the application can use it like a shared library ? (For example in
> windows we can create .dll that can be shared between applications.)
>
>
>
> Thanks in advance.
>
>
>
> Regards,
>
> Shyam
>
>


-- 
Stig Bakken
CTO, Zedge.net - free your phone!