{"id":99706,"date":"2020-04-19T20:12:28","date_gmt":"2020-04-19T12:12:28","guid":{"rendered":"http:\/\/4563.org\/?p=99706"},"modified":"2020-04-19T20:12:28","modified_gmt":"2020-04-19T12:12:28","slug":"%e5%a6%82%e4%bd%95%e5%8f%af%e4%bb%a5%e5%be%97%e7%9f%a5%ef%bc%8c%e8%bf%90%e8%a1%8c%e7%9a%84%e6%9f%90%e4%b8%aa%e6%97%b6%e5%80%99%ef%bc%8c%e4%ba%a7%e7%94%9f%e7%9a%84%e7%9b%ae%e6%a0%87%e5%ad%97%e5%85%b8","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=99706","title":{"rendered":"\u5982\u4f55\u53ef\u4ee5\u5f97\u77e5\uff0c\u8fd0\u884c\u7684\u67d0\u4e2a\u65f6\u5019\uff0c\u4ea7\u751f\u7684\u76ee\u6807\u5b57\u5178\u5360\u7528\u4e86\u591a\u5c11\u5185\u5b58\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5982\u4f55\u53ef\u4ee5\u5f97\u77e5\uff0c\u8fd0\u884c\u7684\u67d0\u4e2a\u65f6\u5019\uff0c\u4ea7\u751f\u7684\u76ee\u6807\u5b57\u5178\u5360\u7528\u4e86\u591a\u5c11\u5185\u5b58\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qazwsxkevin <\/span>  <span><i><\/i> 53<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6bd4\u5982\u60f3\u5f97\u77e5\uff0c\u5728\u51fd\u6570\u8fd0\u884c\u540e\uff0creturn \u56de\u6765\u7684 dict \u5360\u4e86\u591a\u5c11 MB \u5185\u5b58\u8fd9\u6837\uff1f      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"756209\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : casparchen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8fd9\u4e2a\u6807\u9898\u5bf9\u4ed7\u4e0d\u6574\u9f50\u554a\uff0c\u9017\u53f7\u5c11\u4e00\u4e2a\u3002<\/p>\n<p>\u5982\u4f55\u624d\u53ef\u4ee5\u5f97\u77e5\uff0c<br \/>\u8fd0\u884c\u7684\u67d0\u4e2a\u65f6\u5019\uff0c<br \/>\u4ea7\u751f\u7684\u76ee\u6807\u5b57\u5178\uff0c<br \/>\u5360\u7528\u4e86\u591a\u5c11\u5185\u5b58\u3002<\/p>\n<p>\u770b\u770b\u8fd9\u6837\u662f\u4e0d\u662f\u597d\u591a\u4e86 \uff1f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"756210\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : si <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u641c\u7d22\u4e86\u4e00\u4e0b:<br \/>Python \u83b7\u53d6\u5bf9\u8c61\u6240\u5360\u5185\u5b58\u5927\u5c0f\u65b9\u6cd5\uff1a<br \/>sys.getsizeof()<br \/>\u5185\u7f6e\u51fd\u6570__sizeof__()                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"756211\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iamwho <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             sys.getsizeof()<\/p>\n<p>?                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"756212\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qazwsxkevin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @casparchen \u6700\u540e\u4e00\u4e2a\u9017\u53f7\u53ef\u4ee5\u4e0d\u5fc5\u5427\u3002\u3002\u3002<\/p>\n<p>@si \u6211\u7b2c\u4e00\u8ba4\u77e5\u4e5f\u662f\u8fd9\u4e2a\uff0c\u53ea\u662f\u8fd9\u4e2a\u4f3c\u4e4e\u662f\u4e0d\u51c6\u786e\u3002\u3002\u3002<\/p>\n<p>@iamwho \u8fd9\u4e2a\u4f3c\u4e4e\u662f\u4e0d\u51c6\u786e\u7684\u3002\u3002\u3002<\/p>\n<p>\u770b\u4e86\u4e00\u665a\u7f51\u4e0a\u5173\u4e8e\u8fd9\u65b9\u9762\u7684\u5404\u79cd\u8bf4\u6cd5\uff0c\u95ee\u7684\u8fd9\u4e2a\u95ee\u9898\uff0c\u4f3c\u4e4e\u5728 Python \u4e0a\u65e0\u89e3\u3002\u3002\u3002<br \/>\u4e0d\u8fc7\u4e0d\u91cd\u8981\u4e86\uff0c\u6253\u7b97\u628a\u78c1\u76d8\u4e0a 53MB \u7684\u5185\u5bb9\u653e\u5165\u5b57\u5178\u4f20\u6765\u4f20\u53bb\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"756213\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : iamwho <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qazwsxkevin #4 <\/p>\n<p>Return the size of an object in bytes. The object can be any type of object. All built-in objects will return correct results, but this does not have to hold true for third-party extensions as it is implementation specific.<\/p>\n<p>Only the memory consumption directly attributed to the object is accounted for, not the memory consumption of objects it refers to.<\/p>\n<p>https:\/\/docs.python.org\/3\/library\/sys.html#sys.getsizeof                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"756214\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yucongo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bd5\u8bd5 memoryprofile \u5305 \u6216 ipython \u91cc\u7684 %mprun\uff0c \u53c2\u8003 https:\/\/stackoverflow.com\/questions\/563840\/how-can-i-check-the-memory-usage-of-objects-in-ipython\/58362611#58362611                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u53ef\u4ee5\u5f97\u77e5\uff0c\u8fd0\u884c\u7684\u67d0\u4e2a\u65f6\u5019\uff0c\u4ea7\u751f&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/99706"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=99706"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/99706\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=99706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=99706"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=99706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}