File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1212 */
1313 public class Bundle : ObjectPool < Bundle >
1414 {
15- public MemoryStream stream = MemoryStream . createObject ( ) ;
15+ public MemoryStream stream = new MemoryStream ( ) ;
1616 public List < MemoryStream > streamList = new List < MemoryStream > ( ) ;
1717 public int numMessage = 0 ;
1818 public int messageLength = 0 ;
@@ -23,11 +23,22 @@ public Bundle()
2323 {
2424 }
2525
26+ public void clear ( )
27+ {
28+ stream = MemoryStream . createObject ( ) ;
29+ streamList = new List < MemoryStream > ( ) ;
30+ numMessage = 0 ;
31+ messageLength = 0 ;
32+ msgtype = null ;
33+ _curMsgStreamIndex = 0 ;
34+ }
35+
2636 /// <summary>
2737 /// 把自己放回缓冲池
2838 /// </summary>
2939 public void reclaimObject ( )
30- {
40+ {
41+ clear ( ) ;
3142 reclaimObject ( this ) ;
3243 }
3344
@@ -104,6 +115,7 @@ public void send(NetworkInterface networkInterface)
104115 {
105116 streamList [ i ] . reclaimObject ( ) ;
106117 }
118+
107119 streamList . Clear ( ) ;
108120 stream . clear ( ) ;
109121
You can’t perform that action at this time.
0 commit comments