Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | top.py: report mem usage in GB | Giampaolo Rodola | 2021-09-10 | 1 | -4/+6 |
| | | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com> | ||||
* | change tidelift logo | Giampaolo Rodola | 2021-06-06 | 1 | -1/+1 |
| | | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com> | ||||
* | improve github actions | Giampaolo Rodola | 2020-12-19 | 2 | -289/+12 |
| | | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com> | ||||
* | add issue/PR bot | Giampaolo Rodola | 2020-12-17 | 1 | -0/+286 |
| | | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com> | ||||
* | [Windows] #1877: turn OpenProcess -> ERROR_SUCCESS into AD or NSP (#1887) | Giampaolo Rodola | 2020-12-14 | 1 | -3/+4 |
| | | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com> | ||||
* | refactor wheels download scripts | Giampaolo Rodola | 2020-11-15 | 2 | -19/+11 |
| | |||||
* | Remove Travis and Cirrus, use GH also for FreeBSD (#1880) | Giampaolo Rodola | 2020-11-15 | 4 | -54/+61 |
| | |||||
* | Rewrite Linux prlimit() with ctypes (Linux wheels) (#1879) | Giampaolo Rodola | 2020-11-15 | 7 | -8/+75 |
| | |||||
* | Fix py 3.9 [WinError 998] Invalid access to memory location (#1866) | Giampaolo Rodola | 2020-10-31 | 3 | -5/+29 |
| | |||||
* | disk_partitions() maxfile and maxpath (#1863) | Giampaolo Rodola | 2020-10-24 | 1 | -1/+1 |
| | |||||
* | script to convert README for PYPI | Giampaolo Rodola | 2020-10-24 | 1 | -0/+50 |
| | |||||
* | [FreeBSD] process resource limits (#1859) (#809) | Giampaolo Rodola | 2020-10-23 | 1 | -1/+4 |
| | |||||
* | fix #1855 doc | Giampaolo Rodola | 2020-10-19 | 1 | -9/+17 |
| | |||||
* | don't use fstrings | Giampaolo Rodola | 2020-10-17 | 1 | -12/+11 |
| | |||||
* | merge | Giampaolo Rodola | 2020-10-17 | 1 | -0/+154 |
|\ | |||||
| * | pypi download stats script | Giampaolo Rodola | 2020-10-17 | 24 | -260/+435 |
| | | |||||
* | | use python 3 as example in docstrings | Giampaolo Rodola | 2020-10-08 | 15 | -15/+15 |
| | | |||||
* | | refactor scripts using curses | Giampaolo Rodola | 2020-10-08 | 3 | -65/+117 |
| | | |||||
* | | update personal site URL | Giampaolo Rodola | 2020-06-16 | 1 | -1/+1 |
| | | |||||
* | | Wheels6 (#1767) | Giampaolo Rodola | 2020-05-25 | 4 | -179/+148 |
|/ | |||||
* | Wheels 3 (#1764) | Giampaolo Rodola | 2020-05-23 | 1 | -8/+6 |
| | |||||
* | Wheels2 (#1761) | Giampaolo Rodola | 2020-05-18 | 2 | -1/+155 |
| | |||||
* | rename memleaks script | Giampaolo Rodola | 2020-05-13 | 1 | -1/+1 |
| | |||||
* | Memory leak test: take fluctuations into account (#1757) | Giampaolo Rodola | 2020-05-13 | 1 | -1/+0 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Preamble ======= We have a [memory leak test suite](https://github.com/giampaolo/psutil/blob/e1ea2bccf8aea404dca0f79398f36f37217c45f6/psutil/tests/__init__.py#L897), which calls a function many times and fails if the process memory increased. We do this in order to detect missing `free()` or `Py_DECREF` calls in the C modules. When we do, then we have a memory leak. The problem ========== A problem we've been having for probably over 10 years, is the false positives. That's because the memory fluctuates. Sometimes it may increase (or even decrease!) due to how the OS handles memory, the Python's garbage collector, the fact that RSS is an approximation and who knows what else. So thus far we tried to compensate that by using the following logic: - warmup (call fun 10 times) - call the function many times (1000) - if memory increased before/after calling function 1000 times, then keep calling it for another 3 secs - if it still increased at all (> 0) then fail This logic didn't really solve the problem, as we still had occasional false positives, especially lately on FreeBSD. The solution ========= This PR changes the internal algorithm so that in case of failure (mem > 0 after calling fun() N times) we retry the test for up to 5 times, increasing N (repetitions) each time, so we consider it a failure only if the memory **keeps increasing** between runs. So for instance, here's a legitimate failure: ``` psutil.tests.test_memory_leaks.TestModuleFunctionsLeaks.test_disk_partitions ... Run #1: extra-mem=696.0K, per-call=3.5K, calls=200 Run #2: extra-mem=1.4M, per-call=3.5K, calls=400 Run #3: extra-mem=2.1M, per-call=3.5K, calls=600 Run #4: extra-mem=2.7M, per-call=3.5K, calls=800 Run #5: extra-mem=3.4M, per-call=3.5K, calls=1000 FAIL ``` If, on the other hand, the memory increased on one run (say 200 calls) but decreased on the next run (say 400 calls), then it clearly means it's a false positive, because memory consumption may be > 0 on second run, but if it's lower than the previous run with less repetitions, then it cannot possibly represent a leak (just a fluctuation): ``` psutil.tests.test_memory_leaks.TestModuleFunctionsLeaks.test_net_connections ... Run #1: extra-mem=568.0K, per-call=2.8K, calls=200 Run #2: extra-mem=24.0K, per-call=61.4B, calls=400 OK ``` Note about mallinfo() ================ Aka #1275. `mallinfo()` on Linux is supposed to provide memory metrics about how many bytes gets allocated on the heap by `malloc()`, so it's supposed to be way more precise than RSS and also [USS](http://grodola.blogspot.com/2016/02/psutil-4-real-process-memory-and-environ.html). In another branch were I exposed it, I verified that fluctuations still occur even when using `mallinfo()` though, despite less often. So that means even `mallinfo()` would not grant 100% stability. | ||||
* | Add new TestFdsLeak test class (#1752) | Giampaolo Rodola | 2020-05-06 | 2 | -0/+8 |
| | |||||
* | fix some memleak tests on win | Giampaolo Rodola | 2020-05-05 | 1 | -2/+2 |
| | |||||
* | Drastically improve "make test/build" speed. | Giampaolo Rodola | 2020-05-01 | 2 | -15/+15 |
| | | | | | | | Doing "make install" before any test is slow and not really necessary. Instead do "make build", and remove the part import setuptools and test psutil can be imported (do that in make install instead). This way I went down from 0.8 secs (install phase before starting the test) to 0.3 secs! | ||||
* | Per-test file cleanup and new PsutilTestCase (#1743) | Giampaolo Rodola | 2020-04-30 | 1 | -8/+5 |
| | | | | | Test files/dirs are now removed after each test. when invoked via self.get_testfn(). Until now test files were stored in a global variable and were removed at process exit, via atexit.register(), but this didn't work with parallel tests because the fork()ed workers use os._exit(0), preventing cleanup functions to run. All test classes now inherit from PsutilTestCase class, which provides the most important methods requiring an automatic cleanup (get_test_subprocess() and others). | ||||
* | Parallel build (#1741) | Giampaolo Rodola | 2020-04-30 | 1 | -5/+6 |
| | |||||
* | MemoryLeakTest class enhancements (#1731) | Giampaolo Rodola | 2020-04-23 | 2 | -2/+0 |
| | |||||
* | Git hook for renamed/added/deleted files + flake8 print() + tidelift (#1704) | Giampaolo Rodola | 2020-02-21 | 5 | -136/+190 |
| | |||||
* | Add C linter script (#1698) | Giampaolo Rodola | 2020-02-18 | 3 | -4/+92 |
| | |||||
* | get rid of pip_install() code for py2; move everything in runner.py | Giampaolo Rodola | 2020-02-15 | 1 | -1/+1 |
| | |||||
* | point all shebangs to python 3 | Giampaolo Rodola | 2020-02-15 | 34 | -35/+35 |
| | |||||
* | refactor print colors utils | Giampaolo Rodola | 2020-02-15 | 4 | -106/+28 |
| | |||||
* | update doc | Giampaolo Rodola | 2020-02-15 | 4 | -4/+4 |
| | |||||
* | fix #1688: use python3 in GIT commit hook hashbang | Giampaolo Rodola | 2020-02-13 | 1 | -1/+1 |
| | |||||
* | Add support for PyPy on Windows (#1686) | Giampaolo Rodola | 2020-02-11 | 1 | -3/+9 |
| | |||||
* | [Windows] connections() refactoring (#1678) | Giampaolo Rodola | 2020-02-01 | 1 | -1/+1 |
| | |||||
* | AD script: print AD percentage + elapsed time | Giampaolo Rodola | 2020-01-16 | 1 | -2/+7 |
| | |||||
* | properly cleanup C thread | Giampaolo Rodola | 2020-01-14 | 1 | -0/+2 |
| | |||||
* | exec make install before 2 targets | Giampaolo Rodola | 2020-01-14 | 1 | -0/+2 |
| | |||||
* | fix some win tests | Giampaolo Rodola | 2020-01-06 | 1 | -1/+1 |
| | |||||
* | winmake.py: use argparse | Giampaolo Rodola | 2020-01-06 | 1 | -114/+84 |
| | |||||
* | winmake.py: accept builtiple targets/args | Giampaolo Rodola | 2020-01-03 | 1 | -9/+12 |
| | |||||
* | winmake / uninstall: remove installation path from easy-install.pth file | Giampaolo Rodola | 2020-01-02 | 1 | -0/+18 |
| | |||||
* | Drop windows XP support (#1652) | Giampaolo Rodola | 2020-01-01 | 1 | -1/+0 |
| | | | | minimum supported now is Windows Vista | ||||
* | highlight cmd.exe warnings/errs from VS | Giampaolo Rodola | 2019-12-30 | 1 | -1/+53 |
| | |||||
* | #fix #1595 / windows: kill() may not raise AccessDenied | Giampaolo Rodola | 2019-11-20 | 1 | -1/+1 |
| | |||||
* | revert last appveyor change for 3.8 | Giampaolo Rodola | 2019-10-24 | 1 | -1/+1 |
| |