加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Windows 10中的内存泄漏Delphi Seattle中的TNotification?

发布时间:2020-12-14 04:07:21 所属栏目:Windows 来源:网络整理
导读:我正在我的应用程序中实现 Windows 10通知.但是,下面的代码(运行正常)显然会给出1个TNotification对象和2个字符串的备忘录泄漏,但我在块的末尾释放了对象: aNotification := NotificationCenter.CreateNotification;//-- If not assigned then must be Win
我正在我的应用程序中实现 Windows 10通知.但是,下面的代码(运行正常)显然会给出1个TNotification对象和2个字符串的备忘录泄漏,但我在块的末尾释放了对象:
aNotification := NotificationCenter.CreateNotification;

//-- If not assigned then must be Win 8.1 or below
if not assigned(aNotification) then
  exit;

try
  aNotification.Title := AlignMixVersionName + ' License';
  aNotification.AlertBody := aText;

  NotificationCenter.PresentNotification(aNotification);

finally
  aNotification.Free;
end;

我做了一些愚蠢的事情,或者在通知的实施中是否存在内存泄漏?

>史蒂夫

这确实是由TNotificationCenterDelegateActivated引起的泄漏.在其创建中创建了一个TNotification参数的副本,但从未释放.

似乎一些负责此代码的开发人员并不熟悉非ARC环境.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读