Quantasy Geschrieben January 26, 2017 at 18:19 Share Geschrieben January 26, 2017 at 18:19 Hab da glaub ich ein Thread-Alloc no De-Alloc Problem gefunden: Folgender Testcase: while (true){ try{ IPConnection ipConnection = new IPConnection(); ipConnection.connect("host_den_es_nicht_gibt",4223); }catch(Exception ex){ //Hier wirds immer wieder rein kommen, da UnknownHostException } } Das wird ziemlich schnell zu einem MemoryError führen. Grund ist hier: // NOTE: Assumes that socket is null and socketMutex is locked void connectUnlocked(boolean isAutoReconnect) throws java.net.UnknownHostException, java.io.IOException { if(callbackThread == null) { callbackQueue = new LinkedBlockingQueue<CallbackQueueObject>(); callbackThread = new CallbackThread(this, callbackQueue); callbackThread.start(); } Socket tmpSocket = new Socket(host, port); ... Nachdem der callbackThread gestartet wurde, wird ein Socket erstellt und der wirft eine Exception und die Methode wird verlassen... Der Thread aber... der läuft !jeweils! weiter. Vorschlag auf die Schnelle: // NOTE: Assumes that socket is null and socketMutex is locked void connectUnlocked(boolean isAutoReconnect) throws java.net.UnknownHostException, java.io.IOException { try{ if(callbackThread == null) { callbackQueue = new LinkedBlockingQueue<CallbackQueueObject>(); callbackThread = new CallbackThread(this, callbackQueue); callbackThread.start(); } Socket tmpSocket = new Socket(host, port); ... }catch(Exception ex){ callbackQueue.put(new CallbackQueueObject(QUEUE_EXIT, (byte)0,(short)0,0, null)); throw ex; } Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
photron Geschrieben January 30, 2017 at 10:18 Share Geschrieben January 30, 2017 at 10:18 Stimmt, das Problem existiert. Wird in der nächsten Version der Bindings behoben sein. Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
photron Geschrieben February 8, 2017 at 12:43 Share Geschrieben February 8, 2017 at 12:43 Teste mal bitte die angehängte Version der Java Bindings.tinkerforge_java_bindings_2_1_11_24b91bf71eb0.zip Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
Quantasy Geschrieben May 17, 2017 at 09:11 Autor Share Geschrieben May 17, 2017 at 09:11 Ou, da hab ich einen Task übersehen, der an mich gegangen ist... Was ich weiss: In den 2.1.13 Bindings ist der Memory-Fresser noch drin. (Mit dem Beispielprogramm, von oben frisst der Java-Prozess pro Sekunde etwa 500kB) Aber das ist vielleicht, weil ich hier nie geantwortet habe. Soll ich das hier angehängte noch testen? Es scheint mir, als ob das mit dem 2.1.13 bzgl. aufräument im connect() ziemlich übereinstimmt. Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
Quantasy Geschrieben May 17, 2017 at 12:20 Autor Share Geschrieben May 17, 2017 at 12:20 Moment... ich habe mit den falschen Bindings getestet... Ich werde das noch einmal für 2.1.13 machen... Zitieren Link zu diesem Kommentar Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.