{"id":4240,"date":"2019-02-21T20:59:08","date_gmt":"2019-02-21T20:59:08","guid":{"rendered":"https:\/\/cyflexdoc.wpengine.com\/?p=4240"},"modified":"2019-02-22T12:43:22","modified_gmt":"2019-02-22T12:43:22","slug":"cyflex-pre-post-6-1-memory-reuse","status":"publish","type":"post","link":"https:\/\/cyflex.com\/index.php\/cyflex-pre-post-6-1-memory-reuse\/","title":{"rendered":"CyFlex Pre\/Post 6.1 Memory Reuse"},"content":{"rendered":"<p>In versions of ASSET and CyFlex prior 6.1.x, when variables were deleted, they were actually completely removed from memory.<\/p>\n<h3>BEFORE 6.1.x<\/h3>\n<p>As a simple example, if you had a gen_labels file that contained only 3 variables and they were in this order (A, B, C), they would be allocated in memory is this order:<\/p>\n<ul>\n<li>A<\/li>\n<li>B<\/li>\n<li>C<\/li>\n<\/ul>\n<p>If you then modified the file to remove B, then ran gen_labels again, the new memory arrangement would be:<\/p>\n<ul>\n<li>A<\/li>\n<li>C<\/li>\n<li>\u201cempty\u201d<\/li>\n<\/ul>\n<p>The empty memory becomes available for some other application, and might then contain.<\/p>\n<ul>\n<li>A<\/li>\n<li>C<\/li>\n<li>This_label (belonging to a different application, or different gen_labels owner)<\/li>\n<\/ul>\n<p>Obviously, if some other application, say X, was using variable \u2018C\u2019, it is now in a different place. The \u201creconfiguration\u201d of X would cause it to be suspended as soon as the gen_labels application started processing and when gen_labels completes (now A, C, empty), X would reconfigure, and find the new address of \u2018C\u2019. Everything is OK as long as application X gets \u201csuspended,\u201d and doesn\u2019t try to access the memory where \u2018C\u2019 used to be.<\/p>\n<h3>AFTER 6.1.x<\/h3>\n<p>A similar situation as above:<\/p>\n<ul>\n<li>A<\/li>\n<li>B<\/li>\n<li>C<\/li>\n<\/ul>\n<p>Modified gen_labels with \u2018B\u2019 removed. Instead of clearing out the memory used by B, we simply make it \u201cinactive.&#8221; The location of \u2018C\u2019 doesn\u2019t change.<\/p>\n<ul>\n<li>A<\/li>\n<li>(inactive copy of B)<\/li>\n<li>C<\/li>\n<\/ul>\n<p>So, now application X that is using variable C can continue to use that address for C, since it doesn\u2019t get relocated in memory. If application X also was using B, it can continue using the stagnant contents until gen_labels sends the \u201cGO\u201d (reconfig complete). Application X will then reconfigure and report an error, that it can\u2019t find variable \u2018B\u201d, since it no longer is a valid variable.<\/p>\n<p>Let\u2019s say that the gen_labels file is then modified again by re-inserting the \u2018B\u2019 variable, but in a different sequence (A, C, B). Now, the gen_labels app will find the \u2018inactive copy of B\u201d, recognize that the owner name is a match and will make it active again.<\/p>\n<ul>\n<li>A<\/li>\n<li>B<\/li>\n<li>C<\/li>\n<\/ul>\n<p>None of the addresses have changed, even though the sequence in the gen_labels file has changed.<\/p>\n<p>A potential disadvantage of this new approach is that you could end up with a lot of dead \u2018inactive\u2019 variables. The ability to re-use the memory when variables were deleted was the objective of the original design back in the &#8220;goodle&#8221; days when memory was more precious. (If you think that is a typo, google \u201cgoodle days\u201d.) The \u201cshow_mem\u201d utility will tell you how many variables are \u201creserved\u201d (the \u2018resvrd\u2019 column). The reserved REAL and INTEGER variables will be displayed if you use the +v option. (show_mem +v)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In versions of ASSET and CyFlex prior 6.1.x, when variables were deleted, they were actually completely removed from memory. BEFORE 6.1.x As a simple example, if you had a gen_labels file that contained only 3 variables and they were in this order (A, B, C), they would be allocated in memory is this order: A [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[25,23],"class_list":["post-4240","post","type-post","status-publish","format-standard","hentry","category-did-you-know","tag-6-3","tag-fyi"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/posts\/4240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/comments?post=4240"}],"version-history":[{"count":0,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/posts\/4240\/revisions"}],"wp:attachment":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/media?parent=4240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/categories?post=4240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/tags?post=4240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}