Skip to content

Commit 7b0fd66

Browse files
committed
"optimized" memory usage
1 parent 48cc2d3 commit 7b0fd66

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/org/java_websocket/WebSocket.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public enum Role {
1616
CLIENT, SERVER
1717
}
1818

19-
public static int RCVBUF = 64;
19+
public static int RCVBUF = 256;
2020

2121
public static/*final*/boolean DEBUG = false; // must be final in the future in order to take advantage of VM optimization
2222

src/org/java_websocket/WebSocketServer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,14 @@ public void run() {
293293
}
294294

295295
protected void allocateBuffers( WebSocket c ) throws InterruptedException {
296+
if( queuesize.get() >= 2 * decoders.size() + 1 ) {
297+
return;
298+
}
296299
queuesize.incrementAndGet();
297300
buffers.put( createBuffer() );
298301
}
299302
protected void releaseBuffers( WebSocket c ) throws InterruptedException {
300-
queuesize.decrementAndGet();
303+
// queuesize.decrementAndGet();
301304
// takeBuffer();
302305
}
303306

0 commit comments

Comments
 (0)