Delphi中须注意的二个对象(TStreamAdapter、TObjectList)的释放问题

 TObjectList对象的创建方法有一个参数:
constructor TObjectList.Create(AOwnsObjects: Boolean);
从字面就可理解其意义:拥有对象集与否。帮助文档:
If the OwnsObjects property is set to true (the default), TObjectList controls the memory of its objects, freeing an object when its index is reassigned; when it is removed from the list with the Delete, Remove, or Clear method; or when the TObjectList instance is itself destroyed.

这段话的意思就是TObjectList 的几个删除方法和释放方法都受参数AOwnsObjects的影响。我就常常用 TObjectList来管理对象,很方便。记得第一次用时,没看文档,用的默认参数值,重载其释放方法,结果一直报错,因为在DLL中实现,找了很久才找出缘由。


TStreamAdapter对象的创建方法也有一个类似的参数
constructor TStreamAdapter.Create(Stream: TStream; Ownership: TStreamOwnership);
当Ownership参数为soOwned时,则适配器释放时会释放其对应的具体流实例。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
JEDI JCL/JVCL Installation Supported development tools versions: - Delphi 4 Update Pack #3 (JCL Only) - Delphi 5 Update Pack #1 - Delphi 6 Update Pack #2 (including Personal Edition) - Delphi 7 Please make sure you have installed latest update packs. You can download them from Borland Support web page: http://www.borland.com/devsupport/delphi/ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! If you have installed any previous version of the JCL/JVCL you have to delete them. ! ! It is also necessary to remove all installed JCL/JVCL packages from the IDE. ! ! Do not mix files or compiled packages from older versions of the JCL with ! ! current version. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! JEDI INSTALLER ============== Helps you to integrate JCL/JVCL with Delphi IDE. Currently it assists with: - Compiling and installing design-time packages to the IDE - Adding sample JCL Debug extension dialogs to Object Repository - Adding JCL and JVCL \Source path to Library Path in Environment Options - Integrating JCL/JVCL help file to the IDE. ******************************************************** To start Installation click on: Install.bat file in the JEDI root folder. ******************************************************** NOTE: ====== We know of one case where there was a probelm when running install.bat: Undeclared identifier: "TObjectList" Unable to compile file: snmp.pas The solution was to move the D7/D7.Net paths to the end of Environement Vars. To do so, on NT/XP right-click My Computer,Properties,Advanced, Environment Variables, Find the PATH variable in the System variables list, click the Edit button and change the value (move D7 paths to the end).

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值