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

import does not work with memory profiler #77

Open
ahuigo opened this issue Feb 3, 2018 · 1 comment
Open

import does not work with memory profiler #77

ahuigo opened this issue Feb 3, 2018 · 1 comment
Labels

Comments

@ahuigo
Copy link

ahuigo commented Feb 3, 2018

Description

import mod do not work with memory profile.

How to reproduce

mod.py:
print("I'm mod")
main.py:
import mod

Actual results
$ vprof -c cm "main.py"
Running MemoryProfiler...
I'm mod
Running FlameGraphProfiler...
Starting HTTP server...
Expected results

mod.py should be executed 2 times.

$ vprof -c cm "main.py"
Running MemoryProfiler...
I'm mod
Running FlameGraphProfiler...
I'm mod
Starting HTTP server...
Version and platform

vprof 0.37.4
python 3.6.2
Mac OSX

@nvdv
Copy link
Owner

nvdv commented Feb 5, 2018

It happens since profiling agents are run one after another: memory profiler always runs first and in the same process and others do run in their own processes for isolation. These processes are forked after memory profiler imports the code and child processes inherit that and that's why code is not reimported.

@nvdv nvdv added the bug label Feb 5, 2018
@ahuigo ahuigo changed the title import do not work with memory profile import do not work with memory profiler Feb 6, 2018
@ahuigo ahuigo changed the title import do not work with memory profiler import does not work with memory profiler Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants