Get the App
SLTechnology News&Howtos  ›  Development  › 

How to check the memory usage of objects by python

Shulou Source: shulou.com Published: 2022-06-01 02:06:48 09月21日 Update

This article will explain in detail how python checks the memory footprint of objects. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Check the memory usage of an object

Sys.getsizeof () function

Import sysstr1 = "123456" print (sys.getsizeof (str1)) # output what 55python libraries are commonly used by python: 1.requesutswitt. 2.scrapyThere are commonly used libraries in python: 1.requesutsThere are 4.twistestants5.numpyThere are 6.matplotlibters7.pygamaShift 8.ipyhton and so on.

This is the end of this article on "how to check the memory footprint of objects in python". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Memory object situation check article commonly used more good practical content function article knowledge reference help related output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux macOS MariaDB Redmi