7

MonoTouch 6.0.8 release notes say:

Runtime Trampolines: It is no longer necessary to manually manage trampolines in the Mono runtime, trampolines are now handled dynamically.

What does this mean? How do you manually manage trampolines anyway?
Do you still need to add compiler flags when you know you're probably going to run out of trampolines?

Dan Abramov
  • 264,556
  • 84
  • 409
  • 511

1 Answers1

6

This means just as the release notes say that Monotouch now figures out how many trampolines to allocate.

To add more trampolines you add compiler flags such as:

-aot "nrgctx-trampolines=4096" -aot "nimt-trampolines=4096" -aot "ntrampolines=4096"

Usually when you were running out of trampolines meant that you were using a lot of generics and interfaces, which are hard to calculate how much memory needs to be allocated for ahead of time (aot). So Xamarin must have found a magic way to do this calculation and allocate the trampolines accordingly. I couldn't find more information about this.

There's a bit more information about trampolines in general in this thread: http://forums.xamarin.com/discussion/503/trampolines-cost and this thread which was prior to the other one: http://lists.ximian.com/pipermail/monotouch/2012-March/008800.html

Cheesebaron
  • 24,131
  • 15
  • 66
  • 118
  • From what I've read, I had an impression that it is too hard to statically determine the number of trampolines in advance. I'd be delighted to hear some details from Xamarin team on what has changed since then! – Dan Abramov Dec 19 '12 at 00:47
  • 1
    A small clarification: we don't calculate how many trampolines are needed and preallocate them, it would be a very large number (assuming it could be possible to enumerate them correctly) and as such it would increase the binary size quite a bit. Instead we use a memory management trick that allows us to allocate as many trampolines as we need on demand at runtime. The binary size overhead is now fixed (generally 8-12KB) regardless of the number of trampolines the application needs. The runtime memory usage in most cases is lower, too. – lupus Jan 06 '13 at 08:45