We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This leak is in the input/output stream of the native OS allocated here: https://github.com/codenameone/CodenameOne/blob/master/Ports/iOSPort/nativeSources/SocketImpl.m#L25
They are released on disconnect here so it seems this isn't invoked probably because this code isn't invoked due to isSocketConnected returning false.
isSocketConnected
false
I'm guessing that this is because socket doesn't have a finalizer that invokes dispose for us. That would explain the iOS specific behavior.
terminalStatusThread.run(() -> { try { InetAddress localAddress = InetAddress.getLocalHost(); String ip = localAddress.getHostAddress(); String segment = ip.substring(0, ip.lastIndexOf(".") + 1); for(int i=1;i<255;i++) { String current = segment + i; if (!ip.equals(current) && !excludeIps.contains(ip)) { Socket socket = new Socket(10); synchronized(socket) { com.codename1.io.Socket.connect(current, DEFAULT_REST_API_PORT, socket); socket.wait(); } if (socket.isConnected()) { socket.close(); } } } } catch (Exception e) { //Log.e(e); } }); class Socket extends SocketConnection { private InputStream is; public Socket(int connectTimeout) { super(connectTimeout); } @Override public synchronized void connectionError(int errorCode, String message) { notify(); } @Override public synchronized void connectionEstablished(InputStream is, OutputStream os) { this.is = is; notify(); } public synchronized void close() { if (isConnected()) { try { is.close(); } catch(IOException e) { com.codename1.io.Log.e(e); } } } }
The text was updated successfully, but these errors were encountered:
Fix potential memory leak in sockets
ee1534b
Fix for #3726
Another attempt to fix socket memory leak
c53f629
Ideally should fix both #3726 and the regression in #3753
Let me know when this makes it to the public builds and I’ll retest.
I’m still concerned that this bug apparently killed the gc with no immediate effect, leaving a crippled app to die at some later time.
Sorry, something went wrong.
Fixed null pointer regression in native code
8bc1dcc
This occurred due to the fix for #3726 which allowed the GC to collect the output/input streams before the socket itself was collected
shai-almog
No branches or pull requests
This leak is in the input/output stream of the native OS allocated here: https://github.com/codenameone/CodenameOne/blob/master/Ports/iOSPort/nativeSources/SocketImpl.m#L25
They are released on disconnect here so it seems this isn't invoked probably because this code isn't invoked due to
isSocketConnected
returningfalse
.I'm guessing that this is because socket doesn't have a finalizer that invokes dispose for us. That would explain the iOS specific behavior.
The text was updated successfully, but these errors were encountered: