Comments (15)
I am sure this will help. Will look into it asap. Thanks for the reports!!
from sqlpp11-connector-mysql.
By the way, credits: Valgrind detected this issue.
from sqlpp11-connector-mysql.
Thanks! I believe I fixed this with the commit I just pushed to develop
.
from sqlpp11-connector-mysql.
@rbock sorry but now I have 2 possible memory leaks and 1 definite memory leak report from valgrind (before I only had the 2 possible memory leaks).
I'm running valgrind with these options:
valgrind --leak-check=full --error-limit=no --show-leak-kinds=definite,indirect,possible \
--log-file=reports/valgrind.log \
--xml=yes --xml-file=reports/valgrind.xml
I've atteched the XML report valgrind.xml.tar.gz (I don't know why but plain text report is empty...).
from sqlpp11-connector-mysql.
I was able to generate the valgrid plain text log file (you can only generate plain text or XML, but not both at the same time...): valgrind.log
I hope this could help you... thanks! 👍
from sqlpp11-connector-mysql.
Thanks! This helped indeed. A new version is on develop.
I fixed a leak and added an raii struct for mysql_library_init/mysql_library_end. valgrind seems happy in the few tests I ran by now.
from sqlpp11-connector-mysql.
@rbock I will try to test it asap. Thanks!
from sqlpp11-connector-mysql.
@rbock now we have the 2 original possible memory leaks detected by Valgrind (valgrind.log).
I think problem could fix it adding delete _handle
before throwing the exceptions:
connection::connection(const std::shared_ptr<connection_config>& config)
: _handle(new detail::connection_handle_t(config))
{
if (mysql_set_character_set(_handle->mysql.get(), _handle->config->charset.c_str()))
{
delete _handle;
throw sqlpp::exception("MySQL error: can't set character set " + _handle->config->charset);
}
if (mysql_select_db(_handle->mysql.get(), _handle->config->database.c_str()))
{
delete _handle;
throw sqlpp::exception("MySQL error: can't select database '" + _handle->config->database + "'");
}
}
Maybe it's good to take a look to mysql_set_character_set
& mysql_select_db
to check if they also throw any exception...
from sqlpp11-connector-mysql.
Are you sure you are using the latest version? If so, which program are you running with valgrind?
Deleting _handle
does not really help since it is a unique_ptr
and will clean itself up.
There was a problem in case new MYSQL
failed, but I just pushed something that I guess will fix that, too.
For ./tests/Sqlpp11MySQLSampleTest
valgrind tells me:
All heap blocks were freed -- no leaks are possible
Hope this is it now. In any case, thanks for pushing!
from sqlpp11-connector-mysql.
Run Valgrind like this (include possible
leak kind):
valgrind --leak-check=full --error-limit=no --show-leak-kinds=definite,indirect,possible \
--log-file=valgrind.log <program-to-run>
from sqlpp11-connector-mysql.
@rbock I think I correctly updated develop
version due the fact the 1 definite leak error dissapeared with your latest version.
from sqlpp11-connector-mysql.
Sure, that's what I do. And it says no leaks are possible
. This is why I would like to know which program you are running. Can you post the code of a minimal program that shows the leak?
Have you tried with the code I pushed today (like 30mins ago)?
from sqlpp11-connector-mysql.
Also, can you please make sure that you are using either the
const auto library_raii = sqlpp::mysql::scoped_library_initializer_t{};
or
::sqlpp::mysql::global_library_init();
(See tests)
These make sure to initialize the mysql library and free its resources when you are done.
Thanks!
from sqlpp11-connector-mysql.
@rbock finally, with latest changes + calling sqlpp::mysql::global_library_init();
we achieved a clean Valgrind report (valgrind.log).
Thanks a lot!
from sqlpp11-connector-mysql.
Awesome!
Thanks for your help :-)
from sqlpp11-connector-mysql.
Related Issues (20)
- Data is truncated with MariaDB Connector/C 3.0.1+ HOT 11
- Selecting a datetime field always returns epoch HOT 2
- Microseconds ignored when selecting datetime column HOT 1
- Mac osX build HOT 8
- Crash of queries due to MYSQL_RES that is NULL HOT 7
- mysql replace into command HOT 5
- how to use unhex function ,could you give some info? HOT 1
- database name not used HOT 2
- sample code does not work on windows HOT 1
- Can't build DLL on windows HOT 2
- {char,bind}_result_t.size() is unimplemented HOT 5
- How to create mysql::connection without config HOT 2
- TLS/SSL connection is unsupported HOT 1
- Does sqlpp11 support a connection pool? What do I need to do? HOT 2
- How to return mysql auto incorrect when inserting a record in the table? HOT 2
- how can I set mysql options HOT 1
- Error reported while installing sqlpp11-mysql HOT 4
- Why is it necessary to pass database parameter when creating a connection? HOT 3
- Error when compiling HOT 5
- build failed on linux HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlpp11-connector-mysql.