RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1468410 - System Python gc does not reclaim when large memory is allocated
Summary: System Python gc does not reclaim when large memory is allocated
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Python Maintainers
QA Contact: Mirek Długosz
URL:
Whiteboard:
Depends On:
Blocks: 1473612
TreeView+ depends on / blocked
 
Reported: 2017-07-07 02:23 UTC by ckim0419
Modified: 2018-04-10 15:00 UTC (History)
3 users (show)

Fixed In Version: python-2.7.5-63.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 15:00:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
screenshot of top and python (292.44 KB, image/png)
2017-07-07 02:23 UTC, ckim0419
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Python 11849 0 None None None 2017-10-12 15:40:45 UTC
Red Hat Product Errata RHBA-2018:0833 0 None None None 2018-04-10 15:00:55 UTC

Description ckim0419 2017-07-07 02:23:35 UTC
Created attachment 1295144 [details]
screenshot of top and python

Description of problem:
gc of python that comes with RHEL7.3 does not collect all memory it allocates

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Linux localhost.localdomain 3.10.0-514.26.2.el7.x86_64 #1 SMP Fri Jun 30 05:26:04 UTC 2017 x86_64 x86_
Python 2.7.5 (default, Aug  2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2

How reproducible:
d = [ {'sdfdfsdfsfef': 1} for x in xrange(10000000)]
del d
import gc; gc.collect()

Steps to Reproduce:
1. Open python on RHEL7 and enter following python code
2. d = [ {'sdfdfsdfsfef': 1} for x in xrange(10000000)]
3. del d
4. import gc; gc.collect()
5. Run top or ps to get memory allocation of the process

Actual results:
The process still uses 2.4 GB of Memory

Expected results:
Mem usage less than 100KB

Additional info:

Comment 2 Petr Viktorin (pviktori) 2017-10-05 13:40:03 UTC
I plan to look into this in the RHEL 7.5 devel phase.

Comment 3 Petr Viktorin (pviktori) 2017-10-12 15:40:45 UTC
Note that the memory is not leaked; it is only not "returned" to the OS; subsequent allocations will re-use the memory.

That being said, this was fixed upstream (in Python 3.3 and 2.7.7) by using mmap() to allocate arenas and using pre-allocated pools for dicts. From an engineering POV, backporting the patch shouldn't be difficult.

Comment 9 errata-xmlrpc 2018-04-10 15:00:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0833


Note You need to log in before you can comment on or make changes to this bug.