当SmtpClient发送多次调用函数时,会看到内存泄漏

时间:2018-03-06 13:37:35

标签: c#

.net memory profiler report 我必须多次发送邮件,当使用smtpclient类多次执行此操作时,内存会急剧增加......

我尝试过以下事情...... - 为MailMessage调用dispose方法,smtpclient - 手动调用GC.collect方法 什么都没有帮助我...

{
    "children": {
        "ccc": [{
            "id": "ddd",
            "des": "object d",
            "parent": "ccc",
            "other": "zzz",
            "newkey": "newValue"
        }, {
            "id": "zzz",
            "des": "object z",
            "parent": "ccc",
            "other": "ddd",
            "newkey": "newValue" <=need to NOT add this entry
        }],
        "www": [{
            "id": "ddd",
            "des": "object d",
            "parent": "www",
            "other": "ppp"
        }, {
            "id": "kkk",
            "des": "object z",
            "parent": "www",
            "other": "ddd"
        }]
    }
}

}

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

let logoContainer = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 67))
        let imageView = UIImageView(frame: CGRect(x: 0, y: -30, width: 200, height: 67))
        imageView.contentMode = .scaleAspectFit
        let image = UIImage(named: "navbarlogo")
        imageView.image = image
        logoContainer.addSubview(imageView)
        navigationItem.titleView = logoContainer

这是:https://social.msdn.microsoft.com/Forums/vstudio/en-US/28b59c25-bc93-4285-860d-52f1f49d2d43/net-smtp-class-memory-leakage?forum=netfxbcl