byte[] buf=new byte[300]
请问怎么手动 销毁 buf ?buf.Dispose()

解决方案 »

  1.   

    buf.Dispose() 使用不起来啊 
    “System.Array”并不包含对“Dispose”的定义
    请问怎么解决? 我是新手 请包含...
      

  2.   

    hivak47(比尔) 兄:
      如果程序那边有什么样的问题,会出现上述情况?
      请指点一二..
      

  3.   

    int Address=VirtualAllocEx(Process.GetCurrentProcess().Handle,0,300,0x1000,0x04)
    VirtualFreeEx(Process.GetCurrentProcess().Handle,Address,0,0x8000); 
    似乎就可以了
      

  4.   

    zhouzh197895(zhouzh)  兄:
      谢谢你 你的方法可以的 。
     
    看来就剩那段程序在 8K8K的吞噬我得内存了。
      

  5.   

    定时器?
    System.Windows.Forms.Timer吗?
      

  6.   

    是啊 在工具箱中拖出来用的。int Address=VirtualAllocEx(Process.GetCurrentProcess().Handle,0,300,0x1000,0x04)
    VirtualFreeEx(Process.GetCurrentProcess().Handle,Address,300,0x8000); 
    还是错的 
      

  7.   

    GC.Collect() 有奇效!可以解决 
    byte[] buf=new byte[300]

    System.Windows.Forms.Timer
    造成的内存泄漏 但是对
    int Address=VirtualAllocEx(Process.GetCurrentProcess().Handle,0,300,0x1000,0x04)
    VirtualFreeEx(Process.GetCurrentProcess().Handle,Address,300,0x8000); 
    还是无能为力 这我写错在那了 天啊
      

  8.   

    好了 
    int Address=VirtualAllocEx(Process.GetCurrentProcess().Handle,0,300,0x1000,0x04)
    VirtualFreeEx(Process.GetCurrentProcess().Handle,Address,300,0x8000); 
    在.Net平台下似乎 不起作用 虽然它返回了 0
    后来用的是
    int Address=VirtualAlloc(0,300,0x1000,0x04)
    VirtualFree(Address,300,0x8000); 
    就搞定了