![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The memory that it uses is increasing as it runs. |
|
It makes no difference if I move the connection out of the loop. |
|
I don't think that it is a memory 'leak' as leak detectors can't find any leaks. |
#3
| |||
| |||
|
|
Hello, I have a simple logging application that needs to be able to run unattended and reliably for as long as possible. The memory that it uses is increasing as it runs. Here is an simplified example that reproduces the problem. int main() { while (true) { Connection c; c.connect("database","localhost","user","pass"); Query q = c.query(); q << "INSERT INTO table_name (field_1 , field_2) VALUES ( 1 , 2 ) ;"; q.execute(); } } This memory usage of this program gradually rises over time, and has reached tens of megabytes. It makes no difference if I move the connection out of the loop. I don't think that it is a memory 'leak' as leak detectors can't find any leaks. Is this normal ? Alex |
#4
| |||
| |||
|
|
If you are using Visual Studio, the problem is some kind of memory leak having to do with the query object. I haven't narrowed it down, yet. I hope I have some time to look into deeper. Look at this thread for more info on it: http://lists.mysql.com/ plusplus/5743 Has anyone else had time to look into this memory leak? I barely have time to read these emails, these days. =) BTW, Warren, you are doing a great job. Alex Burton wrote: Hello, I have a simple logging application that needs to be able to run unattended and reliably for as long as possible. The memory that it uses is increasing as it runs. Here is an simplified example that reproduces the problem. int main() { while (true) { Connection c; c.connect("database","localhost","user","pass"); Query q = c.query(); q << "INSERT INTO table_name (field_1 , field_2) VALUES ( 1 , 2 ) ;"; q.execute(); } } This memory usage of this program gradually rises over time, and has reached tens of megabytes. It makes no difference if I move the connection out of the loop. I don't think that it is a memory 'leak' as leak detectors can't find any leaks. Is this normal ? Alex |
#5
| |||
| |||
|
|
Look at this thread for more info on it: http://lists.mysql.com/plusplus/5743 Has anyone else had time to look into this memory leak? I barely have time to read these emails, these days. =) |
#6
| |||
| |||
|
|
Hello, I have a simple logging application that needs to be able to run unattended and reliably for as long as possible. The memory that it uses is increasing as it runs. Here is an simplified example that reproduces the problem. int main() { while (true) { Connection c; c.connect("database","localhost","user","pass"); Query q = c.query(); q << "INSERT INTO table_name (field_1 , field_2) VALUES ( 1 , 2 ) ;"; q.execute(); } } This memory usage of this program gradually rises over time, and has reached tens of megabytes. It makes no difference if I move the connection out of the loop. I don't think that it is a memory 'leak' as leak detectors can't find any leaks. Is this normal ? Alex |
#7
| |||
| |||
|
|
Bill K wrote: Look at this thread for more info on it: http://lists.mysql.com/plusplus/5743 Has anyone else had time to look into this memory leak? I barely have time to read these emails, these days. =) I read back through that thread, and saw why I forgot about this issue...this post settled the issue for me: http://lists.mysql.com/plusplus/5767 Do you not find that convincing? I agree, I do not see the problem to be with MySQL++ - but the problem |
|
Whether memory usage increases in this situation isn't in question. Whose fault it is is the question. Matt seems to think it's the CRT, and I don't see a reason to argue. That said, I proposed a bunch of tests in that thread that didn't get done. (Try different compilers, try v2.0.0, etc.) So, we're not operating on complete data here. |
#8
| |||
| |||
|
|
I agree, I do not see the problem to be with MySQL++ |
#9
| |||
| |||
|
|
Bill K wrote: I agree, I do not see the problem to be with MySQL++ I'm not entirely convinced of that, either. While MySQL++ proper may not be leaking the memory, it may be possible to change it to avoid the symptom. Until all those tests are tried, we don't know that, either. But, this is not my itch: I don't use MySQL++ on Windows. At this point, my limit is suggesting places to look for the workaround, or things to try that will indirectly show where the workaround may be found. Until someone finds that workaround, it'll be up to individual MySQL++ users to come to their own accommodation with this CRT feature/bug. That would be unfortunate, but I can live with it. It's a similar situation with threading, only the thread question is farther along: thread-safety also isn't my itch, but there's a document stating what we have to do to be thread-safe w.r.t. the MySQL C library, so I have a development plan to make MySQL++ take care of some of this for you. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsu... mac (DOT) com |
#10
| |||
| |||
|
|
Warren, Bill I have managed to modify the mysql++ code to remove the problem. In the query ctors, instead of initialising the base class with std: stream(0) and then calling init(sbuffer_) in the body of the ctor, just initialise with std: stream(sbuffer_).I havent looked through the visual c++ standard code enough to be able to explain it completely, but calling std: stream(0) and then calling init effectively calls basic_ostream::init twice. Initialising the stream twice must be what is causing the problem.An alternative would be to default construct std: stream and then call init, but don't call std: stream(0) and then init.I'm not sure what the meaning of calling std: stream(0) is anyway.I am not sure what effect this change would have on mysql++ using other implementations of the c++ standard library, but from looking at the code in the gnu standard library, it looks like it will all work the same - except that it doesn't leak when you call init twice apparently. Alex On Thursday, October 05, 2006, at 05:12PM, Warren Young <mysqlpp (AT) etr-usa (DOT) com> wrote: Bill K wrote: I agree, I do not see the problem to be with MySQL++ I'm not entirely convinced of that, either. While MySQL++ proper may not be leaking the memory, it may be possible to change it to avoid the symptom. Until all those tests are tried, we don't know that, either. But, this is not my itch: I don't use MySQL++ on Windows. At this point, my limit is suggesting places to look for the workaround, or things to try that will indirectly show where the workaround may be found. Until someone finds that workaround, it'll be up to individual MySQL++ users to come to their own accommodation with this CRT feature/bug. That would be unfortunate, but I can live with it. It's a similar situation with threading, only the thread question is farther along: thread-safety also isn't my itch, but there's a document stating what we have to do to be thread-safe w.r.t. the MySQL C library, so I have a development plan to make MySQL++ take care of some of this for you. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsu... mac (DOT) com -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsu... mac (DOT) com |
![]() |
| Thread Tools | |
| Display Modes | |
| |