File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
MLAPI/NetworkingManagerComponents/Binary Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 33using System . Collections . Generic ;
44using System . Runtime . InteropServices ;
55using System . Text ;
6+ using UnityEngine ;
67
78namespace MLAPI . NetworkingManagerComponents . Binary
89{
@@ -17,6 +18,7 @@ public class BitReader : IDisposable
1718 private byte [ ] readFrom ;
1819 private long bitCount = 0 ;
1920
21+ private static int pools = 0 ;
2022 private static readonly Queue < BitReader > readerPool = new Queue < BitReader > ( ) ;
2123
2224 private BitReader ( byte [ ] readFrom )
@@ -28,7 +30,10 @@ public static BitReader Get(byte[] readFrom)
2830 {
2931 if ( readerPool . Count == 0 )
3032 {
33+ if ( pools > 10 )
34+ Debug . LogWarning ( "MLAPI: There are more than 10 BitReaders. Have you forgotten do dispose? (More readers hurt performance)" ) ;
3135 BitReader reader = new BitReader ( readFrom ) ;
36+ pools ++ ;
3237 return reader ;
3338 }
3439 else
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ public static BitWriter Get()
8686 {
8787 if ( writerPool . Count == 0 )
8888 {
89- Debug . LogWarning ( "MLAPI: There can be no more than 10 BitWriters. Have you forgotten do dispose? (It will still work with worse performance)" ) ;
89+ Debug . LogWarning ( "MLAPI: There are more than 10 BitWriters. Have you forgotten do dispose? (It will still work with worse performance)" ) ;
9090 return new BitWriter ( ) { outsidePool = true } ;
9191 }
9292 else
You can’t perform that action at this time.
0 commit comments