Comments (3)
I think it might have something to do with how many lines are in the loop and the amount lineno
is incremented by (in trace_memory_usage
). Incrementing lineno
by 2 with a loop such as the one below:
$ python memory_profiler.py ~/myscript.py
Line # Mem usage Increment Line Contents
==============================================
1 @profile
2 46.16 MB 0.00 MB def f():
3 8.02 MB -38.15 MB for i in range(1):
4 46.16 MB 38.15 MB a = [0] * 5000000
I'm not sure. I don't quite yet understand how the trace function works.
from memory_profiler.
This is no longer the case in recent versions:
$ make test
python -m memory_profiler test/test_func.py
Filename: test/test_func.py
Line # Mem usage Increment Line Contents
================================================
2 35.020 MiB 35.020 MiB @profile
3 def test_1(i):
4 # .. will be called twice ..
5 35.020 MiB 0.000 MiB c = {}
6 35.582 MiB 0.051 MiB for i in range(i):
7 35.582 MiB 0.512 MiB c[i] = 2
from memory_profiler.
I think we can close this one as well, we can reopen or file new issues if the problem appears again.
from memory_profiler.
Related Issues (20)
- How to test memory usage for a time-loop function?
- Inconsistent result between line profiler and plot
- The @profile decorator will profile another decorator when chaining multiple decorators into a function. HOT 1
- include-children in decorator
- do not work in python 3.11 HOT 3
- Is maintained or not? HOT 4
- [BUG] invalid non-printable character U+FEFF HOT 6
- After delete the snapshot file, the function cannot be used when the memory profiler is opened again
- mprof: error: unrecognized arguments: --backend
- AttributeError: module 'pylab' has no attribute 'ioff' (Python 3.9) HOT 2
- Adding "--" to argment list may change the argument of the program started by `mprof run`. HOT 2
- non-ascii source characters misprocessed (maybe through 8859?) HOT 3
- mem usage and increment print is missing HOT 2
- I'm a beginner in the world of developing, I just finished learning python and html and css what's the next step please?I need a help with that. HOT 1
- Is it possible to compare two plots? HOT 1
- negative memory increment
- Is there a specific reason memory_usage return None when stream=True ? HOT 1
- Inconsistent documentation of units
- not sure how to interpret these results
- `tracemalloc` `backend` broken for `memory_usage`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memory_profiler.