SndStream是定义为Tmemorystream的文件流
1、如果没有释放,会有什么后果?
2、如果用free释放后,SndStream是否会自动置为nil?
3、SndStream.free与SndStream.clear有何区别?

解决方案 »

  1.   

    不释放会出现异常地
    SndStream.clear是清楚流中的内容,之后还可以往流中写入新内容
    而SndStream.free释放掉此流所占用地内存空间,释放后就不能再使用了,除非重新create
    free后SndStream是否会自动置为nil你设个断点调试一下就看出来了,这个我忘了
      

  2.   

    更正:SndStream.clear是清除与流相关的所有缓存,但对象还存在,可以通过create在创建内存空间来使用
    SndStream.free是销毁流对象,调用对象的析构器,调用之后对象已经别销毁了
      

  3.   

    Frees the memory buffer, discarding all data associated with the memory stream.procedure Clear;DescriptionUse Clear to empty the memory buffer for the memory stream and free all associated memory. In addition to freeing the memory associated with the memory buffer, ClearSets the Memory property to nil.
    Sets the Position property to 0.
    Sets the Size property to 0.