{"action":"created","issue":{"url":"https://api.github.com/repos/plone/plone.dexterity/issues/25","labels_url":"https://api.github.com/repos/plone/plone.dexterity/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/plone/plone.dexterity/issues/25/comments","events_url":"https://api.github.com/repos/plone/plone.dexterity/issues/25/events","html_url":"https://github.com/plone/plone.dexterity/issues/25","id":58717623,"number":25,"title":"Possible memory leak with createContentInContainer","user":{"login":"marfago","id":1191501,"avatar_url":"https://avatars.githubusercontent.com/u/1191501?v=3","gravatar_id":"","url":"https://api.github.com/users/marfago","html_url":"https://github.com/marfago","followers_url":"https://api.github.com/users/marfago/followers","following_url":"https://api.github.com/users/marfago/following{/other_user}","gists_url":"https://api.github.com/users/marfago/gists{/gist_id}","starred_url":"https://api.github.com/users/marfago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marfago/subscriptions","organizations_url":"https://api.github.com/users/marfago/orgs","repos_url":"https://api.github.com/users/marfago/repos","events_url":"https://api.github.com/users/marfago/events{/privacy}","received_events_url":"https://api.github.com/users/marfago/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-24T10:11:42Z","updated_at":"2015-02-25T11:11:17Z","closed_at":null,"body":"Hi,\r\n\r\nI have the need to import 1M of object in Plone. Each one is of the same type defined with dexterity and behaviours. I've created a small script for loading data which I launch with `instance run load.py`.\r\nWhat happens is that during the whole process the memory increases constantly, and then it reaches 16GB of consumption. I've find the code which causes this (potential) memory leak:\r\n\r\nIn particular here:\r\n```python\r\nobj_fotogramma = createContentInContainer(folder, 'planetek.igm_types.fotogramma', False,\r\n                                         title=fotogramma_collocazione + \" - \" + fotogramma_quota + \" - \" + title + \" \" + fotogramma_text_laber,\r\n                                         #description=title,\r\n                                         fotogramma=fotogramma_fotogramma,\r\n                                         strisciata=fotogramma_strisciata,\r\n                                         foglio=fotogramma_foglio,\r\n                                         collocazione=fotogramma_collocazione,\r\n                                         data=data,\r\n                                         quota=fotogramma_quota,\r\n                                         scala=fotogramma_scala,\r\n                                         supporto=fotogramma_supporto,\r\n                                         diapositiva=fotogramma_diapositiva,\r\n                                         negativo=fotogramma_negativo,\r\n                                         focale=fotogramma_focale,\r\n                                         macc_presa=fotogramma_macc_presa,\r\n                                         formato=fotogramma_formato,\r\n                                         ripresa=fotogramma_ripresa,\r\n                                         immagine=fotogramma_foto,\r\n                                         coordinates=fotogramma_geom\r\n                                         )\r\n```\r\n\r\nIn the function `createContentInContainer` the part of code which causes the leak looks due to createContent in utils.py and in particular:\r\n\r\n```python\r\nfor schema in schemas:\r\n    behavior = schema(content)\r\n    print type(behavior)\r\n    for name in schema.names():\r\n            if name in fields:\r\n                setattr(behavior, name, fields[name])\r\n                del fields[name]\r\n```\r\n\r\nStill digging down, I've finally found the problem is with ```behavior = schema(content)```\r\n\r\nDo you have any idea why does it happen?\r\nMarco"},"comment":{"url":"https://api.github.com/repos/plone/plone.dexterity/issues/comments/75943173","html_url":"https://github.com/plone/plone.dexterity/issues/25#issuecomment-75943173","issue_url":"https://api.github.com/repos/plone/plone.dexterity/issues/25","id":75943173,"user":{"login":"marfago","id":1191501,"avatar_url":"https://avatars.githubusercontent.com/u/1191501?v=3","gravatar_id":"","url":"https://api.github.com/users/marfago","html_url":"https://github.com/marfago","followers_url":"https://api.github.com/users/marfago/followers","following_url":"https://api.github.com/users/marfago/following{/other_user}","gists_url":"https://api.github.com/users/marfago/gists{/gist_id}","starred_url":"https://api.github.com/users/marfago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marfago/subscriptions","organizations_url":"https://api.github.com/users/marfago/orgs","repos_url":"https://api.github.com/users/marfago/repos","events_url":"https://api.github.com/users/marfago/events{/privacy}","received_events_url":"https://api.github.com/users/marfago/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T11:11:17Z","updated_at":"2015-02-25T11:11:17Z","body":"Can this be the cause?\r\nhttp://stackoverflow.com/questions/15455048/releasing-memory-in-python"}}