This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
memory leak on MySQL_Connection.MySQL_Packet.buffer #18
Comments
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use SS/CS pin GP17 for ARDUINO_ARCH_MBED similar to arduino-pico core 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use SS/CS pin GP17 for ARDUINO_ARCH_MBED similar to arduino-pico core 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use SS/CS pin GP17 for ARDUINO_ARCH_MBED similar to arduino-pico core 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use the same SS/CS pin GP17 for [ArduinoCore-mbed mbed_rp2040 core](https://github.com/arduino/ArduinoCore-mbed) as [arduino-pico rp2040 core](https://github.com/earlephilhower/arduino-pico) 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use the same SS/CS pin GP17 for [ArduinoCore-mbed mbed_rp2040 core](https://github.com/arduino/ArduinoCore-mbed) as [arduino-pico rp2040 core](https://github.com/earlephilhower/arduino-pico) 4. Update `Packages' Patches`
The new MySQL_MariaDB_Generic releases v1.6.0 has just been published. Your contribution is noted in Contributions and Thanks Please have some more tests to verify the bugs have been squashed and if there is any more bug. With the contributions from users like you, the library is better and better everyday. Best Regards, Release v1.6.0
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The packet buffer is allocated with the first message, and reallocated if a bigger message arrives.
So far, so good.
The problem: it is never freed.
So if your MySQL_Connection is a global variable, there is no problem. But if you used MySQL_Connection as a local variable in a function, that buffer is never freed.
The cause for this: there is no class destructor to check for this buffer and free it before the destruction of the object.
The fix? Personally, I would add a destructor in the class MySQL_Packet, that free(buffer);
Workaround for this? before exiting your function (in which MySQL_Connection local variable was created and used) perform this:
if (MySQL_Connection.buffer) free(MySQL_Connection.buffer);
The text was updated successfully, but these errors were encountered: