Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Garbage collection not working correctly in Python 2.3 #45746

Closed
pythonmeister mannequin opened this issue Nov 8, 2007 · 7 comments
Closed

Garbage collection not working correctly in Python 2.3 #45746

pythonmeister mannequin opened this issue Nov 8, 2007 · 7 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@pythonmeister
Copy link
Mannequin

pythonmeister mannequin commented Nov 8, 2007

BPO 1405
Nosy @gvanrossum, @tiran

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2007-11-10.18:23:40.735>
created_at = <Date 2007-11-08.16:31:30.586>
labels = ['interpreter-core', 'invalid', 'performance']
title = 'Garbage collection not working correctly in Python 2.3'
updated_at = <Date 2007-11-10.18:23:40.734>
user = 'https://bugs.python.org/pythonmeister'

bugs.python.org fields:

activity = <Date 2007-11-10.18:23:40.734>
actor = 'gvanrossum'
assignee = 'none'
closed = True
closed_date = <Date 2007-11-10.18:23:40.735>
closer = 'gvanrossum'
components = ['Interpreter Core']
creation = <Date 2007-11-08.16:31:30.586>
creator = 'pythonmeister'
dependencies = []
files = []
hgrepos = []
issue_num = 1405
keywords = []
message_count = 7.0
messages = ['57256', '57263', '57316', '57317', '57319', '57351', '57352']
nosy_count = 4.0
nosy_names = ['gvanrossum', 'christian.heimes', 'pythonmeister', '_doublep']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'resource usage'
url = 'https://bugs.python.org/issue1405'
versions = ['Python 2.5', 'Python 2.3']

@pythonmeister
Copy link
Mannequin Author

pythonmeister mannequin commented Nov 8, 2007

when running this script:
aList = []
for i in xrange(5E5):
aList += [[]]
for j in xrange(10):
aList[-1].append([])
del aList

It does not give back the memory

even a

import gc
gc.collect()

afterwards does not do it.

In Python 2.5 the memory is freed again correctly, at least under Windows.

The problem came up, because I was parsing a CSV file of 50 MB which
resulted in memory usage of more than 500 MB.

@pythonmeister pythonmeister mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Nov 8, 2007
@tiran
Copy link
Member

tiran commented Nov 8, 2007

I'm sorry but Python 2.3 is long gone. Its maintenance cycle has ended
over a year ago.Nobody is going to fix an outdated version when the new
versions of Python are working fine. Can you update to a new version of
Python?

@tiran tiran closed this as completed Nov 8, 2007
@pythonmeister
Copy link
Mannequin Author

pythonmeister mannequin commented Nov 9, 2007

No, I can't.
As many Front Arena Developers on the 1.6/2.0/2.1/2.2 can't.
Python 2.4 will be in Front Arena 4.0.
Lightyears away from here.
Same behaviour seen under Solaris 10 / Python 2.5.1

@tiran tiran reopened this Nov 9, 2007
@doublep
Copy link
Mannequin

doublep mannequin commented Nov 9, 2007

See if gc.set_threshold (0, 0, 0) helps.

@gvanrossum
Copy link
Member

How do you know the memory isn't given back? It may be available for
reallocation within Python, just not given back to the operating system.
That's not necessarily a leak or a bug; that could just be heap
fragmentation. There's nothing you can do about it.

@doublep
Copy link
Mannequin

doublep mannequin commented Nov 10, 2007

Looks like the memory _is_ freed. As Guido said, "It may be available
for reallocation within Python, just not given back to the operating
system". I suggest closing this as invalid.

paul@gonzo:~$ python
Python 2.3.5 (#2, Oct 16 2006, 19:19:48)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gc
>>> len ([object for object in gc.get_objects () if isinstance (object,
list)])
25
>>> aList = []
>>> for i in xrange(5E5):
...     aList += [[]]
...     for j in xrange(10):
...         aList[-1].append([]
...
...
KeyboardInterrupt
>>>         aList[-1].append([]
KeyboardInterrupt
>>>
paul@gonzo:~/emacs$ python
Python 2.3.5 (#2, Oct 16 2006, 19:19:48)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gc
>>> len ([object for object in gc.get_objects () if isinstance (object,
list)])
25
>>> aList = []
>>> for i in xrange(5E5):
...     aList += [[]]
...     for j in xrange(10):
...         aList[-1].append([])
...
__main__:1: DeprecationWarning: integer argument expected, got float
>>> del aList
>>> len ([object for object in gc.get_objects () if isinstance (object,
list)])
25

@doublep
Copy link
Mannequin

doublep mannequin commented Nov 10, 2007

Meh, copied too much. Disregard first part, second shows it.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

2 participants