Skip to content

WiFiClientSecure connect memory leak #6257

Closed
@serpetti

Description

@serpetti

Board

ESP32 Dev Module

Device Description

Every time I create a connection with WiFiClientSecure library I looseabout 100B of heap memory. Everything works, I connect(), I get data and I stop(). But the during next connect() I loose other memory.
Thanks

Hardware Configuration

esp32 dev kit 1 without PINs used

Version

latest master

IDE Name

Platform IO

Operating System

Windows 10

Flash frequency

40MHz

PSRAM enabled

no

Upload speed

115200

Description

Memory leak

Sketch

wifiClientSecure = new WiFiClientSecure();

        wifiClientSecure->setCACert(root_ca);

        if (!wifiClientSecure->connect("www.hamqsl.com", 443))
            Serial.println("Connection failed!");
        else
        {
            wifiClientSecure->println("GET https://www.hamqsl.com/solarxml.php HTTP/1.0");
            wifiClientSecure->println("Host: www.hamqsl.com");
            wifiClientSecure->println("Connection: close");
            wifiClientSecure->println();
            
            while (wifiClientSecure->connected())
            {
                String line = wifiClientSecure->readStringUntil('\n');
                if (line == "\r")
                {
                    break;
                }
            }            
            
            int len=0;
            while (wifiClientSecure->available())
            {
                char c = wifiClientSecure->read();  
                xmlRaw += c;     
                len++;
            }
            
            wifiClientSecure->flush();
            wifiClientSecure->stop();                 
    
            Serial.Println(xmlRaw);
        }   
        if(wifiClientSecure) delete wifiClientSecure;

Debug Message

No messages, only leak

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions