%global _empty_manifest_terminate_build 0 Name: python-mem-top Version: 0.2.1 Release: 1 Summary: Shows top suspects for memory leaks in your Python program. License: MIT URL: https://github.com/denis-ryzhkov/mem_top Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c3/f0/8b6cc0ff682dee2760bfeb045fb4c0188a6040aee36f6c1e0e4568d4609e/mem_top-0.2.1.tar.gz BuildArch: noarch %description Usage:: pip install mem_top from mem_top import mem_top # From time to time: logging.debug(mem_top()) # print(mem_top()) # Notice which counters keep increasing over time - they are the suspects. Counters: "mem_top" iterates all objects found in memory and calculates: * refs - number of direct references from this object to other objects, like keys and values of dict * E.g. a dict {("some", "complex", "key"): "value"} will have "refs: 2" - 1 ref for key, 1 ref for value * Its key ("some", "complex", "key") will have "refs: 3" - 1 ref per item * bytes - size of this object in bytes * types - number of objects of this type still kept in memory after garbage collection Real life example:: refs: 144997 defaultdict(, { {'.:..............:.......': {... 1578 {... 968 {... 968 {... 968 {... 767 [... 726 {... 608 {... types: 292499 217912 72702 72702 12340 defaultdict(, { {'.:..............:.......': {... 1578 {... 968 {... 968 {... 968 {... 767 [... 726 {... 608 {... types: 292499 217912 72702 72702 12340 defaultdict(, { {'.:..............:.......': {... 1578 {... 968 {... 968 {... 968 {... 767 [... 726 {... 608 {... types: 292499 217912 72702 72702 12340 > filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-mem-top -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 0.2.1-1 - Package Spec generated