[MonoTouch] Understanding the impact of trampolines
Rolf Bjarne Kvinge
rolf at xamarin.com
Thu Mar 22 23:43:13 UTC 2012
Hi Stuart,
On device we generate all the necessary code at build time in a process
known as Ahead of Time compilation (similar to Microsoft's ngen), because
we're not allowed to jit code on devices. Unfortunately there are a few
things that cannot be determined statically - for instance generic
interfaces might need different vtables depending on which type the
interface is instantiated with. (For this case it is technically possible
to determine the maximum number of vtables, but the number would be
potentially enormous - multiply the number of generic interfaces times the
number of types in your app...). We cannot allocate memory for these
vtables dynamically at runtime, so we've picked a reasonable default and
allow the user to increase this value if they run into issues. This is the
basic theory for the trampolines (the exact problem is a bit different,
depending on the type of trampolines, but that's not really important).
So you can add as many trampolines as you want, but memory usage will
increase. That's also all there is to it: the app will not get slower
(unless if the increased memory usage causes it to run slower, due to
out-of-memory warnings, etc). It also means that you only have to increase
the number of trampolines of the type you're actually having problems with,
if you increase the others you'll increase the size of your executable
needlessly.
I hope this helps,
Rolf
On Thu, Mar 22, 2012 at 11:17 AM, slodge <me at slodge.com> wrote:
> I've hit a few problems in apps with running out of trampolines -
> especially
> because I used DI with lots of interfaces.
>
> To get around this I've tried command line changes like:
>
> -aot "nrgctx-trampolines=4096" -aot "nimt-trampolines=4096" -aot
> "ntrampolines=4096"
>
> However, I'm not really sure what I'm doing here.... I know the defaults
> are
> 1024. What impact does changing these values have on performance, on image
> size or anything else? Is there any guidance available on these numbers?
> Does it matter that I'm increasing all 3 values together? Or should I just
> focus on the one(s) that seem to be giving me problems?
>
> Thanks
>
> Stuart
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Understanding-the-impact-of-trampolines-tp4495086p4495086.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monotouch/attachments/20120323/226a5da9/attachment.html>
More information about the MonoTouch
mailing list