{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/3090","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/3090/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/3090/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/3090/events","html_url":"https://github.com/nim-lang/Nim/issues/3090","id":93943291,"number":3090,"title":"\"out of memory\" not caught by try/except","user":{"login":"jlp765","id":5141524,"avatar_url":"https://avatars.githubusercontent.com/u/5141524?v=3","gravatar_id":"","url":"https://api.github.com/users/jlp765","html_url":"https://github.com/jlp765","followers_url":"https://api.github.com/users/jlp765/followers","following_url":"https://api.github.com/users/jlp765/following{/other_user}","gists_url":"https://api.github.com/users/jlp765/gists{/gist_id}","starred_url":"https://api.github.com/users/jlp765/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlp765/subscriptions","organizations_url":"https://api.github.com/users/jlp765/orgs","repos_url":"https://api.github.com/users/jlp765/repos","events_url":"https://api.github.com/users/jlp765/events{/privacy}","received_events_url":"https://api.github.com/users/jlp765/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-09T03:18:47Z","updated_at":"2015-07-09T03:45:46Z","closed_at":null,"body":"The following doesn't get caught (when allocating data strucures larger than the availale system memory):\r\n```\r\nlet loopc = 9_999_999_999\r\nvar \r\n  s0: seq[int] = @[]\r\n  s1: seq[int] = @[]\r\n  s2: seq[int] = @[]\r\ntry:\r\n  s0 = newSeq[int](loopc+1)\r\n  s1 = newSeq[int](loopc+1)\r\n  s2 = newSeq[int](loopc+1)\r\nexcept:\r\n  echo \"Memory Error\"\r\n  discard\r\n  quit()\r\n```\r\n----------\r\nFeature request for Nim V2:\r\nAbility to store the standard system defined collections on \"hidden\" disk storage, so can operate on data structures of greater size than available memory, and Nim handles the swapping for the user.\r\nFor speed reasons, maybe this is a compile time option that is only enabled when wanted??"},"comment":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/comments/119805386","html_url":"https://github.com/nim-lang/Nim/issues/3090#issuecomment-119805386","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/3090","id":119805386,"user":{"login":"reactormonk","id":49185,"avatar_url":"https://avatars.githubusercontent.com/u/49185?v=3","gravatar_id":"","url":"https://api.github.com/users/reactormonk","html_url":"https://github.com/reactormonk","followers_url":"https://api.github.com/users/reactormonk/followers","following_url":"https://api.github.com/users/reactormonk/following{/other_user}","gists_url":"https://api.github.com/users/reactormonk/gists{/gist_id}","starred_url":"https://api.github.com/users/reactormonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactormonk/subscriptions","organizations_url":"https://api.github.com/users/reactormonk/orgs","repos_url":"https://api.github.com/users/reactormonk/repos","events_url":"https://api.github.com/users/reactormonk/events{/privacy}","received_events_url":"https://api.github.com/users/reactormonk/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T03:45:46Z","updated_at":"2015-07-09T03:45:46Z","body":"Yes, OOM exceptions tend to be ugly to handle. Because the code for the error handling can't allocate more memory, otherwise you'd have more OOM.\r\n\r\nBtw, no need to swap stuff from nim, your OS should handle swapping."}}