Bugs item #1524938, was opened at 2006-07-19 04:46 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1524938&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Feature Request Status: Open Resolution: None Priority: 5 Submitted By: Mark Matusevich (markmat) Assigned to: Nobody/Anonymous (nobody) Summary: MemoryError with a lot of available memory - gc not called Initial Comment: Also the gc behavior is consistent with the documentation, I beleave it is wrong. I think, that Gc should be called automatically before any memory allocation is raised. Example 1: for i in range(700): a = [range(5000000)] a.append(a) print i This example will crash on any any PC with less then 20Gb RAM. On my PC (Windows 2000, 256Mb) it crashes at i==7. Also, this example can be fixed by addition of a call to gc.collect() in the loop, in real cases it may be unreasonable. ---------------------------------------------------------------------- >Comment By: Martin v. Löwis (loewis) Date: 2006-07-23 22:00 Message: Logged In: YES user_id=21627 This is very difficult to implement. The best way might be to introduce yet another allocation function, one that invokes gc before failing, and call that function in all interesting places (of which there are many). Contributions are welcome and should probably start with a PEP first. ---------------------------------------------------------------------- Comment By: Rene Dudfield (illume) Date: 2006-07-20 01:20 Message: Logged In: YES user_id=2042 Perhaps better than checking before every memory allocation, would be to check once a memory error happens in an allocation. That way there is only the gc hit once there is low memory. So... res = malloc(...); if(!res) { gc.collect(); } res = malloc(...); if(!res) { raise memory error. } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1524938&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com