Hi Hao,
As for the SMO management code, I've also tested it locally and the memory
behavior does be like you mentioned. I think it is the expected behavior
since the .NET managed memory management is different from raw unmanaged
application in which memory will be released immediately after we delete
objects. In .net , those object allocated on CLR heap will not be released
like unmanaged objects, it is the CLR GC that control when to sweep and
collect unused objects. Also, managed heap is like a pooled memory block,
when it allocate a block of memory, it may keep it for sometime (for
caching) in case some other new created objects will use it, so it is
expected to see that the .NET application keep certain size of memory after
it previously use them(not release immediately).
If you do care about memory leaking, you can use performance counter to
lookup both total private bytes and managed heap size of the application.
(Task manager "mem" column only show private bytes). If all the memory are
hold in managed CLR heap, I think it is ok. If there is continous memory
increase in unmanaged heap(managed heap not grow), we may take further look
into it. Anyway, so far I haven't found any existing memory leak issue of
SMO objects.
http://msdn2.microsoft.com/en-us/library/ms954591.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.