```
a = a + findgen(100)
```

is equivalent to both options as well, since the summation takes place in the array newly created by `findgen`

.
]]>`IDL> startMemory = memory(/current)`

IDL> a = temporary(a) + findgen(100)

IDL> print, memory(/highwater) - startMemory

616

IDL> startMemory = memory(/current)

IDL> a += findgen(100)

IDL> print, memory(/highwater) - startMemory

616

and

`IDL> startMemory = memory(/current)`

IDL> a += b + 5

IDL> print, memory(/highwater) - startMemory

616

IDL> startMemory = memory(/current)

IDL> a = temporary(a) + b + 5

IDL> print, memory(/highwater) - startMemory

237

`a = temporary(a) + findgen(size(a,/DIM))`

Here the equivalent `a += findgen(size(a,/DIM))`

avoids the overhead of the call to the `temporary`

function.

Nevertheless, the use of the composite assignment performs worse when used with expressions involving other named variables, since the evaluation of the expression implies memory allocation for the result.

For example,

The expression `a += b + 5`

implies the creation of a temporary array containing `b + 5`

followed by the composite assignment.

The expression `a = temporary(a) + b + 5`

does the whole calculation in place.

Regards,

Diego

]]>```
a = sin(temporary(a))
```

I’d like to do the sine calculation in place, but wouldn’t `temporary(a)`

be passed by value to SIN, thereby creating a copy of `a`

?
]]>```
a = temporary(a[*, *, i])*5
```

Using TEMPORARY here doesn’t save anything since a subscripted array creates an