Hi,
Python script is taking more memory in python3.11.11 compared to previous version 3.10.16 especially while using packages like redis, pyroute2 etc.
What could be the change for this behavior in python3.11? Does any optimizations are possible here?
1.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
- 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