{"id":175,"date":"2019-04-28T09:23:04","date_gmt":"2019-04-28T09:23:04","guid":{"rendered":"https:\/\/docs.sisus.co\/power-inspector\/?p=175"},"modified":"2019-09-16T13:41:36","modified_gmt":"2019-09-16T13:41:36","slug":"disposing-drawers","status":"publish","type":"post","link":"https:\/\/docs.sisus.co\/power-inspector\/extending-power-inspector\/disposing-drawers\/","title":{"rendered":"08. Disposing Drawers"},"content":{"rendered":"<p>Power Inspector uses the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Object_pool_pattern\" target=\"_blank\" rel=\"noopener noreferrer\">object pool pattern<\/a>, <strong>reusing<\/strong> existing instances of drawers to reduce the amount of garbage generated.<\/p>\n<p>For this reason, when creating your own drawers, you&#8217;ll need to be careful that they are reverted back to their default states when they are disposed in the pool.<\/p>\n<h1><strong>Dispose method<\/strong><\/h1>\n<p>When drawers instances are placed in the object pool, the Dispose method (as defined by the <strong>IDrawer<\/strong> interface) gets called.<br \/>\nDuring the execution of this method, the state of the drawer should be completely <strong>reverted<\/strong> back to its <strong>default state<\/strong>.<\/p>\n<pre><strong>NOTE:<\/strong> When you <strong>override<\/strong> the Dispose method, remember to always also call <strong>base<\/strong>.<strong>Dispose<\/strong>!<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Power Inspector uses the object pool pattern, reusing existing instances of drawers to reduce the amount of garbage generated. For this reason, when creating your own drawers, you&#8217;ll need to be careful that they are reverted back to their default states when they are disposed in the pool. Dispose method When drawers instances are placed ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/docs.sisus.co\/power-inspector\/extending-power-inspector\/disposing-drawers\/\" title=\"read more\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/175"}],"collection":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/comments?post=175"}],"version-history":[{"count":8,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/175\/revisions"}],"predecessor-version":[{"id":1026,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/175\/revisions\/1026"}],"wp:attachment":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/media?parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/categories?post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/tags?post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}