Skip to content

websockets not releasing memory after disconnect #2541

New issue

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

Closed
themindfactory opened this issue Sep 22, 2016 · 3 comments
Closed

websockets not releasing memory after disconnect #2541

themindfactory opened this issue Sep 22, 2016 · 3 comments
Labels
component: libraries type: bug waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.

Comments

@themindfactory
Copy link
Contributor

websockets not releasing memory after disconnect from the far end.

when I get a disconnect event I do a .disconnect(number) I do get back around 100 bytes of the 200, if I do not do a .disconnect(number) I lose about 200 bytes per disconnect from the far end.

there is nothing in my websocketevent function that would affect the heap.

Hardware

Hardware: ESP-12
Core Version: 2.3.0

Description

websockets not releasing memory after disconnect

Settings in IDE

Module: Generic ESP8266 Module
Flash Size: 4MB/1MB
CPU Frequency: 80Mhz
Flash Mode: dio
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: nodemcu

Sketch

void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght) {
  Serial.printf("WS#%d\n", num);
  webSocketNum = num;
  switch (type) {
    case WStype_DISCONNECTED:
      Serial.println(F("Websockets Disconnected!"));
      webSocket.disconnect(num);
      break;

    case WStype_CONNECTED: 
        IPAddress ip = webSocket.remoteIP(num);
        Serial.printf("Connected from %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
        Serial.printf("Payload1 %s\n", payload);
        Serial.printf("Length %d\n", lenght);
       break;

    case WStype_TEXT:
      Serial.print(F("Payload2 length="));
      Serial.println(lenght);

      // possible long string
      serialSendString((const char*)payload);
  }
}

Debug Messages

messages here
@themindfactory
Copy link
Contributor Author

This is a fairly serious issue, I have thoroughly gone over my code and can not see that it is the reason, can someone play with websocket example and make a break connections to test, I use the chrome extension to test, "Simple Websocket Client" so that would be a good thing to try in chasing this bug.

RichardS

@devyte
Copy link
Collaborator

devyte commented Oct 12, 2017

@themindfactory please try:

@devyte devyte added the waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. label Oct 12, 2017
@devyte
Copy link
Collaborator

devyte commented Feb 28, 2018

Closing due to lack of feedback and age.

@devyte devyte closed this as completed Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: libraries type: bug waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

No branches or pull requests

2 participants