just wild guess......

来源: 2009-10-21 17:16:11 [旧帖] [给我悄悄话] 本文已被阅读:

1. why apply using to SGeneric? does it contain any system resources like file handle,connection...etc? if not, u may take it off as "using" is converted into try/finally block which is expensive. it seems to me when u done ur logic in new created window,u may explicitly set generic=null to allow next round garbage collector reclaim this block of memory. or just leave it, once it's out of its scope, nothing references it. it becomes orphan and garbage collector will work on it anyway.

2. next round garbage collection may not be happen immediately until memory reaches its threshold. it's not recommended that u explicitly call gc.collect(). in that sense, it might be called "memory leak", but it's quite normal to me.(that's why i don't like .net for this part)

3.how do u check ur memory red gate ants memory profiler? that's good one,mime got expired at work last week, i'll do some experiment tonight at home. if i find something interesting, i'll let u know.


it's very good topic, thx for sharing with us.