-
Notifications
You must be signed in to change notification settings - Fork 26
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
option to count only memory used in current thread / limit_memory("10MB", current_thread_only=True), #111
Comments
We will be working on this soon. This may require some changes in |
PR up: #117 |
ecerulm
added a commit
to urllib3/urllib3
that referenced
this issue
Aug 19, 2024
Some time ago I requested this functionality to the pytest-memray team bloomberg/pytest-memray#111, Now that functionality is available since `pytest-memray==1.6.0`. Enabling `current_thread_only` will give less false positives, as memory leaks in the server thread (which is not part of the SUT, in this case urllib3) will not be reported. The need for this setting comes from #3358 where we had to modify a bunch of test cases to properly clean up resources due to false positives.
pquentin
pushed a commit
to urllib3/urllib3
that referenced
this issue
Aug 21, 2024
Some time ago I requested this functionality to the pytest-memray team bloomberg/pytest-memray#111, Now that functionality is available since `pytest-memray==1.6.0`. Enabling `current_thread_only` will give less false positives, as memory leaks in the server thread (which is not part of the SUT, in this case urllib3) will not be reported. The need for this setting comes from #3358 where we had to modify a bunch of test cases to properly clean up resources due to false positives.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
Currently
limit_memory
will count the allocations made in other threads (if I understood it right). I want an option to count only the memory allocations made on the current thread (the thread running the test code).The use case is
Related to #109 (comment) , In this case there are threads started for some tests that are never terminated, the allocations from those unrelated threads show as part of limit_memory on a later test. Ideally although those threads should have been terminated they should not show up in the later test.
The alternatives is to run the server outside the test framework, or use
multiprocessing
, both alternatives since they run the server in a different process won't show up in thelimit_memory
but that requires other means to control the server. When having the server as a thread you can have more tight control/communication so it's convenient.The text was updated successfully, but these errors were encountered: