google app engine - python: Leaking memory when looping through user-list -


i have sort of memory leakage in program. made a previous post code-snippet more streamlined.

it fetches 100 users per loop; got ~6000 users.

def sync_users():   api = api()#class handling api-request - no leak   maxresults = 100   page_token = ""   user  = none   users = none   while true:     gc.collect()     logging.debug(memory_usage().current())     users = api.user_list(maxresults=maxresults, pagetoken=page_token)     if "users" not in users:       break     user in users["users"]:       deferred.defer(sync_user, user)     if "nextpagetoken" in users:       page_token = users["nextpagetoken"]     else:       break 

i ran paused task-queue no other task ran in parallel. memory-log.

    92.703125     92.70703125     93.81640625     94.80859375     96.2109375     97.3515625     98.75     99.71484375     101.1796875     102.44140625     103.5     ...     150.25390625     151.2421875 

memory usage grows linearly , ends with: exceeded soft private memory limit of 128 mb 153 mb after servicing 5586 requests total

sometimes manage finish before memory runs out; it's not infinite loop.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -