none
Field and Range lifetime management RRS feed

  • Question

  • Hello,

    In a C# word Add-in, for Word 15.0.4771.1000, the document model is modified directly. Fields and ranges are requested in a number of ways. For example through the ActiveWindow.Selection.

    Profiling word while working with the plugin reveals that the number of Range and Field objects never decreases.

    Currently there are 246223 Range objects and 117811 Field objects. The winword.exe process size is up to 893.3 MB 835.4MB of which are Unmanaged Memory.

    How should the lifecycle of Range and Field objects be managed so that they are destroyed after being used?

    Is there some other likely cause of the enormous ammount of unmanaged memory?

    Cheers,

    Philip

    Wednesday, December 2, 2015 11:31 AM

Answers