When a Google Apps Script function fails and returns \"Out of memory error\", what does that refer to?
Has the code reached a memory max for a particular variable?
The same error I had faced was due to a variable increased in size more than permitted (Although I am not aware what the maximum permitted size is). So I believe its the "memory max for a particular variable reached" case. The workaround I used was to write the stream of data in a google doc instead. Its simple and works without any troubles.
The behavior of Google Apps Script is deceiving (at least for me) at times, ie. not observed consistency in its error messages. Probably one of those instances occurring with you.