Question: I want to perform an action based on the `Spinner`s selected value inside of the `Button`s `onClick()` method. 

How I get the selected item of a `Spinner`?

My code:

```
spinner = (Spinner) findViewById(R.id.spinner);
btnConvert = (Button) findViewById(R.id.btnConvert);
btnConvert.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
    // Here I want to perform an action based on the selected item of a listener
}

```

Answer: 
[`alloca()`](http://linux.die.net/man/3/alloca) is what you're looking for. Of course, if you know your structures dimensions statically, it'd be better to use local variables instead.
As far as I am aware, converting heap allocations to stack allocations is a library thing, not something that the compiler has any control over. Indeed, on Linux, `malloc` uses the [`brk`](http://linux.die.net/man/2/brk) system call (which resizes the stack) rather than use [`mmap`](http://linux.die.net/man/2/mmap), except for larger pages.

To quote from [the source](http://www.eglibc.org/cgi-bin/viewcvs.cgi/trunk/libc/malloc/malloc.c?rev=13698&view=auto):

```
The old goals we kept are
  1) try to get the long lived large allocations to use mmap()
  2) really large allocations should always use mmap()
  and we're adding now:
  3) transient allocations should use brk() to avoid forcing the kernel
     having to zero memory over and over again

```