3 messages in com.mysql.lists.bugsPerhaps a bug in mysql_free_result
FromSent OnAttachments
Michael Widenius12 Apr 2001 04:22 
Sinisa Milivojevic12 Apr 2001 05:14 
Sebastien Petit12 Apr 2001 10:07 
Subject:Perhaps a bug in mysql_free_result
From:Michael Widenius (mon@mysql.com)
Date:04/12/2001 04:22:07 AM
List:com.mysql.lists.bugs

Hi!

"Sebastien" == Sebastien Petit <spe@selectbourse.com> writes:

Sebastien> Hi everybody,

Sebastien> I use mysql-3.23.36 with FreeBSD-4.2-RELEASE on a PIII-800 1 Go RAM 2
DD Sebastien> RAID 1 Sebastien> When I use mysql_store_result to retreive about 338488 rows with a
table of Sebastien> about 23 rows and I use mysql_fetch_result to read rows, when I read
row, I Sebastien> malloc some memory to copy the row result. Sebastien> The problem is, when I call mysql_free_result after that,
mysql_free_result Sebastien> doesn't free memory.

How do you see that mysql_free_result doesn't free memory?

Note that even if mysql_free_result() calls 'free()' it doesn't mean that the memory will be available by other processes (In other words, top or ps will not notice this). The memory will however be available for your client applications for use in future allocations.

This is just simple how malloc()/free() works; Please do some reading of how malloc() / free() works!

In some cases free() may free memory to the system, but this only happens when you free blocks that are allocated last from the heap.

Regards, Monty