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

Python3.11 memory usage is more #131538

Closed
RasnaT opened this issue Mar 21, 2025 · 2 comments
Closed

Python3.11 memory usage is more #131538

RasnaT opened this issue Mar 21, 2025 · 2 comments
Labels
3.11 only security fixes performance Performance or resource usage

Comments

@RasnaT
Copy link

RasnaT commented Mar 21, 2025

Bug report

Bug description:

After upgrading to Python3.11.11 it is seen that most of the scripts are taking more memory compared to previous version 3.10.16.

is this a bug or expected behavior due to new adaptive interpreter?

Below is an example script run with redis and iproute, where ~4MB memory increase is seen.

python3 -m memory_profiler testmem.py
Running Python Version: 3.10.16 (main, Feb 20 2025, 10:49:09) [GCC 8.4.0]
Filename: testmem.py

Line # Mem usage Increment Occurrences Line Contents
 3     21.2 MiB     21.2 MiB           1   @profile
 4                                         def do_stuff():
 5     21.2 MiB      0.0 MiB           1       import sys
 6     21.2 MiB      0.0 MiB           1       python_version = sys.version
 7     21.2 MiB      0.0 MiB           1       print(f"Running Python Version: {python_version}")
 8     25.8 MiB      4.6 MiB           1       import redis
 9     35.6 MiB      9.8 MiB           1       import pyroute2

2:

python3 -m memory_profiler testmem.py
Running Python Version: 3.11.11 (main, Mar 12 2025, 15:15:10) [GCC 8.4.0]
Filename: testmem.py
Line # Mem usage Increment Occurrences Line Contents
 3     23.8 MiB     23.8 MiB           1   @profile
 4                                         def do_stuff():
 5     23.8 MiB      0.0 MiB           1       import sys
 6     23.8 MiB      0.0 MiB           1       python_version = sys.version
 7     23.8 MiB      0.0 MiB           1       print(f"Running Python Version: {python_version}")
 8     29.1 MiB      5.4 MiB           1       import redis
 9     40.0 MiB     10.9 MiB           1       import pyroute2

Redis version is 4.5.5
pyroute2 version is 0.7.5
OS:Linux controller 5.15.178

CPython versions tested on:

3.11

Operating systems tested on:

Linux

@RasnaT RasnaT added the type-bug An unexpected behavior, bug, or error label Mar 21, 2025
@ZeroIntensity
Copy link
Member

Yeah, I don't think we have any guarantees about memory usage between versions, we care more about performance.

@ZeroIntensity ZeroIntensity added the pending The issue will be closed if no feedback is provided label Mar 21, 2025
@terryjreedy
Copy link
Member

In any case, 3.11 only gets security fixes

@terryjreedy terryjreedy closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2025
@terryjreedy terryjreedy added performance Performance or resource usage 3.11 only security fixes and removed pending The issue will be closed if no feedback is provided type-bug An unexpected behavior, bug, or error labels Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

3 participants