Hi!
>>>>> "tobi" == tobi <Tobias> writes:
tobi> Hello.
tobi> I'd like to have some help with a memoryleak. It's probably in my
tobi> clientprogram but I can't find anywhere in the documentation how to free
tobi> this memory. I found the leak using dbx under solaris. here is the trace for
tobi> the leak.
tobi> Found 4 leaked blocks with total size 32656 bytes
tobi> At time of each allocation, the call stack was:
tobi> [1] my_malloc() at 0xe610adb0
tobi> [2] alloc_root() at 0xe610de64
tobi> [3] unpack_fields() at 0xe6106334
tobi> [4] mysql_read_query_result() at 0xe61078c4
tobi> [5] mysql_real_query() at 0xe6108624
tobi> [6] our_mysql_query() at line 211 in "mysql.c"
tobi> the relevant line in mysql.c reads:
tobi> if (mysql_real_query(mysql,query,strlen(query))){
tobi> after this I run store_result and if there was a result I doo
tobi> mysql_free_result, but this memory wont be deallocated. so I wonder if there
tobi> is something I missing?
I did an extra check of the code but I could not find any reason for
how this could happen.
The above result should be freed by the following code
mysql_free_result():
if (result->fields)
free_root(&result->field_alloc,MYF(0));
Any change you could try to do a trace file that shows your problem?
Just follow the instruction in the MySQL manual in section 'Debugging
a MySQL client'. Note that to debug memory allocations, you should
configure MySQL with --with-debug=full.
Regards,
Monty