Google app engine 在总共处理0个请求后,超过了128 MB的软专用内存限制,达到171 MB

Google app engine 在总共处理0个请求后,超过了128 MB的软专用内存限制,达到171 MB,google-app-engine,google-cloud-platform,google-cloud-storage,Google App Engine,Google Cloud Platform,Google Cloud Storage,我在将数据加载到Google云存储时遇到以下错误 我找到了两篇同样的帖子,但我想知道内存泄漏发生在哪里。请让我知道如何找到 错误消息: Exceeded soft private memory limit of 128 MB with 171 MB after servicing 0 requests total 代码: 谢谢,在为0个请求提供服务之后,可能存在重复的-这可能表明您配置的实例类(或您拥有的默认实例类)可能没有足够的内存用于您的应用程序,请尝试配置具有更多内存的实例类。请在中查找

我在将数据加载到Google云存储时遇到以下错误

我找到了两篇同样的帖子,但我想知道内存泄漏发生在哪里。请让我知道如何找到

错误消息:

Exceeded soft private memory limit of 128 MB with 171 MB after servicing 0 requests total
代码:


谢谢,

在为0个请求提供服务之后,可能存在重复的
-这可能表明您配置的实例类(或您拥有的默认实例类)可能没有足够的内存用于您的应用程序,请尝试配置具有更多内存的实例类。请在中查找
实例类
。另请看@Dan——实际上我正在为谷歌云存储编写一个文件。猜测一下,它是将所有内容写入内存,然后复制到GCS。正因为如此,我才犯了这个错误。我已经给出了将文件写入GCS的上述代码。实际上,我需要将更大的文件写入GCS,所以考虑检查。@Dan-我是否需要将数据逐块写入GCS以避免内存问题,或者此内存问题完全不同。
def download_files(service, report_id, report_fragment):
  """Generate and print sample report.

  Args:
    service: An authorized Doublelcicksearch service.
    report_id: The ID DS has assigned to a report.
    report_fragment: The 0-based index of the file fragment from the files array.
  """
  print "Enter into download_files", report_id
  filename="/xyz/DoubleClickSearch_Campaign"+report_id+"_"+report_fragment+".csv"
  bucket_name="awstogcs"
  fname="DoubleClickSearch_Campaign11212"
  write_retry_params = _gcs.RetryParams(backoff_factor=1.1)
  gcs_file=_gcs.open(filename, 'w', content_type='text/plain',retry_params=write_retry_params)
  request = service.reports().getFile(reportId=report_id, reportFragment=report_fragment)
  gcs_file.write(request.execute())
  gcs_file.close()