Stumped by memory leak caused by using a `map` function

In an effort to have more compact, readable code, I've started swapping out some of my hand-rolled for-loops for a more functional approach using a `map` function, e.g.

function map(func, array) {
var size = array.size();
for (var i=0; i < size; i++) {
array= func.invoke(array);
}
}
[/CODE]

Readability-wise, this has been great; however, it looks like it's the source of a pernicious memory-leak, and I can't figure out what exactly is going on.

An example of code that leaks is:

function func(elem) {
return "really long string that will make a memory leak more obvious";
}

var array = [1, 2, 3, 4, 5];
map(method(:func), array);


An example of code that doesn't leak:

for (var i=0; i < array.size(); i++) {
array= func(array);
}
[/CODE]

AFAICT, all we did here was inline the for-loop, nothing else. So, I can't figure out why version-1 with `map` leaks, and version 2 with an inline-for-loop doesn't.

Any insight would be greatly appreciated here!