Menu

#21 Not releasing untouched sector data.

v2.0
closed-fixed
Federico
5
2015-09-18
2014-12-11
No

In CompoundFile.Commit(bool) during releaseMemory mode non dirty existent sectors are not cleaned up.

Current setup:

if (s != null && s.DirtyFlag)
{
    ...
    commit to file
    ...
}
else
{
    gap = true;
    continue;
}
if (releaseMemory)
{
    s.ReleaseData();
    s = null;
    sectors[i] = null;
}

If a sector exists and is not dirty the continue in the else will prevent the release of the untouched memory even though the transaction is completed.

Suggestion:

if (s != null && s.DirtyFlag)
{
    ...
    commit to file
    ...
}
else
{
    gap = true;
}
if (releaseMemory && s != null)
{
    s.ReleaseData();
    s = null;
    sectors[i] = null;
}

Also possibly implement a method to release memory without touching the file (for memory management during CFSUpdateMode.ReadOnly).

Unit tests all pass with these changes.

Discussion

  • Federico

    Federico - 2014-12-13
    • status: open --> accepted
     
  • Federico

    Federico - 2014-12-13

    Thank you very much. Committed to dev.

     
  • Federico

    Federico - 2015-09-18
    • status: accepted --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB