Note that there are some explanatory texts on larger screens.

plurals
  1. POdellocating memory does it degrade the performance?
    primarykey
    data
    text
    <p>This is a basic Question for all programming languages, But I am much familiar with VBA.So Im using the vba code. I got some doubt with deallocating the memory.Does the performance degarde when we erase or swap off the allocated contents ? something like </p> <p><strong>Method I</strong> where we deallocate the allocated memory</p> <pre><code>sub my_function() Dim a() as string redim a(1 to 15) 'some for loop goes here aroung 50 iterations erase a ' Deallocate the array ' some piece of code goes here may be 40 lines end sub </code></pre> <p><strong>Method II</strong> where we dont deallocate any memory</p> <pre><code>sub my_function() Dim a() as string redim a(1 to 15) 'some for loop goes here aroung 50 iterations 'some piece of code goes here may be 40 lines end sub </code></pre> <p><strong>Method III</strong> where we dellocate memory at the last statment</p> <pre><code>sub my_function() Dim a() as string redim a(1 to 15) 'some for loop goes here aroung 50 iterations 'some piece of code goes here may be 40 lines erase a 'deallocate the memory end sub </code></pre> <p>The question </p> <p><strong>Method I</strong> is erase a, Does it eat up any huge cycles ? or more bytes of ram ? or should i wait for the end of the sub routine or should I go for using erase statement</p> <p><strong>Method II</strong> There is no erase statement in the sub routine, the function kills the array at the end of sub routine but I dont need the array till the end of function so is this fast enough or optimized?</p> <p><strong>Method III</strong> At the first watch, people say its a foolish thing to dellocate at the end of the sub routine as itself kills at the end,But I am eager to know Thanks </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload