diff --git a/Bundle.cs b/Bundle.cs index c013092..a158376 100644 --- a/Bundle.cs +++ b/Bundle.cs @@ -12,7 +12,7 @@ */ public class Bundle : ObjectPool { - public MemoryStream stream = new MemoryStream(); + public MemoryStream stream = MemoryStream.createObject(); public List streamList = new List(); public int numMessage = 0; public int messageLength = 0; @@ -23,22 +23,11 @@ public Bundle() { } - public void clear() - { - stream = MemoryStream.createObject(); - streamList = new List(); - numMessage = 0; - messageLength = 0; - msgtype = null; - _curMsgStreamIndex = 0; - } - /// /// 把自己放回缓冲池 /// public void reclaimObject() - { - clear(); + { reclaimObject(this); } @@ -101,8 +90,8 @@ public void send(NetworkInterface networkInterface) { for(int i=0; i