<https://lavag.org/topic/6534-memory-fragmentation/>
<http://schema.org/text>
"I have a very large application that is experiencing a memory fragmentation problem. The root cause of the problem seems to be the fact that I am building and modifying an array of complex clusters.  This data structure is used to mirror the data displayed by the tree control.  I have done this to avoid writing to the tree control until the user chooses to display the VI that contains the tree.  The idea was to encapsulate all GUI writes into a single VI and to avoid them altogether if the data is never requested to be displayed.  But the result is a large and ever growing data structure that slowly fragments the memory of the PC until the app slows to a standstill.  In my app I create N instances of this data structure to track all the DUTs being tested and then I run it for 24 hours.  So, by the end of the test period, 100s of MB have been consumed and every little memory allocation takes forever. \nAfter digging into the code for causes and solutions, I find that there are some functions where memory buffers are being created that I don't understand and can't seem to eliminate.  These allocations seem to be making copies of the entire data structure and some of it's largest components, causing ever increasing memory allocations.  I was hoping someone could point out the obvious mistake and offer a solution. \nAlso, I was wondering if the new InPlace structure in LV8.5 could solve this problem.  How complex can the code within the InPlace structure be and does ALL of it have to be in place operations? \nAttached is the code and an RTF document with some screen shots of the code showing the offending allocations. \nThanks for any ideas you can offer, \n-John \n"
<https://lavag.org/topic/6534-memory-fragmentation/?tab=comments#comment-38245>