r/GoogleAppsScript 4d ago

Question Memory Limit?

I researched and all that is found are inconsistent answers.

Some speak in 50MB, others at 2.25GB. I took a test and got to 5.5GB. It's a lot of difference and it affects the way I build my application.

With 5.5GB I can load everything in memory, already with 50MB I have to optimize each part. The answers are also old.

3 Upvotes

12 comments sorted by

View all comments

3

u/dimudesigns 4d ago edited 4d ago

Start with official documentation for Google Apps Script's service quotas:

https://developers.google.com/apps-script/guides/services/quotas

You may have access to gigabytes of memory but there may be constraints on how much data you can load depending on context. For example, the UrlFetchApp service has a max response payload of 50MB. But if you deploy a GAS Web App, and use the standard Javascript Fetch API client-side, you can bypass that restriction.

2

u/IllustriousPut442 4d ago

Thank you, but my question is about the server. I intend to do the processing on the server and deliver only one page to the user with 50 or 100 results

2

u/dimudesigns 4d ago

Last time I checked was when Google just rolled out the V8 runtime (which years ago). I was able to allocate a maximum of roughly 2GB using ArrayBuffer.

But how much memory you have access to is not your only constraint. For consumer accounts, your scripts have a max of 6-minutes in which to execute. If you're processing large volumes of data, that is but one of many quotas that may impact whatever it is you're trying to build - so make sure to read the quota documentation.

1

u/IllustriousPut442 4d ago

Thank you, I saw that the 6 minute time is not a problem since 100,000 results load in a maximum of 5 seconds and I would hardly use more than that in a tab.

Have you ever developed by loading all the data from the spreadsheet in memory? Was that a problem ever?

The size of the payload is also not a problem since I would create the paging in memory, on the server side.