{"action":"opened","issue":{"url":"https://api.github.com/repos/casadi/casadi/issues/1632","labels_url":"https://api.github.com/repos/casadi/casadi/issues/1632/labels{/name}","comments_url":"https://api.github.com/repos/casadi/casadi/issues/1632/comments","events_url":"https://api.github.com/repos/casadi/casadi/issues/1632/events","html_url":"https://github.com/casadi/casadi/issues/1632","id":113555374,"number":1632,"title":"Mysterious memoery leak in combination with numpy","user":{"login":"jgillis","id":329032,"avatar_url":"https://avatars.githubusercontent.com/u/329032?v=3","gravatar_id":"","url":"https://api.github.com/users/jgillis","html_url":"https://github.com/jgillis","followers_url":"https://api.github.com/users/jgillis/followers","following_url":"https://api.github.com/users/jgillis/following{/other_user}","gists_url":"https://api.github.com/users/jgillis/gists{/gist_id}","starred_url":"https://api.github.com/users/jgillis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgillis/subscriptions","organizations_url":"https://api.github.com/users/jgillis/orgs","repos_url":"https://api.github.com/users/jgillis/repos","events_url":"https://api.github.com/users/jgillis/events{/privacy}","received_events_url":"https://api.github.com/users/jgillis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-27T10:44:24Z","updated_at":"2015-10-27T10:44:24Z","closed_at":null,"body":"```python\r\nimport casadi as C\r\nimport numpy as np\r\n\r\nimport sys\r\n\r\nmode = int(sys.argv[1])\r\n\r\ndef foo():\r\n  A = np.zeros((964,1292),dtype=np.uint8)\r\n\r\n  if mode>0:\r\n    getProjections()\r\n  \r\n  if mode<2:  \r\n    A = np.clip(np.array(A,dtype=float)-10,-3.0,3.0)\r\n\r\ndef getProjections():\r\n  voxel = C.SX.sym(\"[x,y,z]\")\r\n\r\n  uv = voxel\r\n  for i in range(20):\r\n    uv = uv**2-uv\r\n\r\n  f = C.SXFunction(\"f\",[voxel],[uv])\r\n\r\nfor num in range(320):\r\n    logodds = foo()\r\n\r\nimport os;import psutil;pid = os.getpid();p = psutil.Process(pid);print \"heap [MB]\", sorted(p.memory_maps(),key=lambda x: x.rss)[-1].rss/1e6\r\n```\r\n\r\n```\r\npython test.py 1 # heap [MB] 208\r\npython test.py 0 # heap [MB] 12\r\npython test.py 2 # heap [MB] 29\r\n```\r\n\r\n"}}