Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

memory leak on MySQL_Connection.MySQL_Packet.buffer #18

Closed
pabloandresm opened this issue Mar 10, 2022 · 1 comment
Closed

memory leak on MySQL_Connection.MySQL_Packet.buffer #18

pabloandresm opened this issue Mar 10, 2022 · 1 comment

Comments

@pabloandresm
Copy link
Contributor

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);

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`
@khoih-prog
Copy link
Owner

Hi @pabloandresm

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

  1. Fix memory leak bugs. Check memory leak on 'server_version' #17 and memory leak on MySQL_Connection.MySQL_Packet.buffer #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 as arduino-pico rp2040 core
  4. Update Packages' Patches

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants