2013-11-20 83 views
0

我使用boto.sqs模塊作爲Amazon SQS(簡單隊列服務)的抽象。 經過一段時間後,我發現boto.sqs.get_queue()會導致內存不斷泄漏。Boto SQS get_queue內存泄漏

出於測試目的,我創建簡單的django管理命令:

from django.core.management.base import BaseCommand 

class Command(BaseCommand): 
    help = "My shiny new management command." 

    def handle(self, *args, **options): 
     import boto.sqs, time, gc 

     while True: 
      conn = boto.sqs.connect_to_region('eu-west-1', aws_access_key_id='my', aws_secret_access_key='my') 
      queue = conn.get_queue('my') 

      print('queue is {}'.format(queue)) 
      time.sleep(1) 
      gc.collect() # just in case 

當我執行此命令通過過程中消耗的存儲器不斷增加。 有趣的是,當從簡單的test.py文件執行相同的循環爲'python test.py'時,它不會記憶。

我在我的Django設置中有一行DEBUG = False。

任何人都可以建議如何擺脫這memleak?

回答

0

只需從INSTALLED_APPS中刪除debug_toolbar ...