List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:June 5 2009 2:41pm
Subject:Re: BLOB memory deallocation (storage engine dev)
View as plain text  
Hi!

Just noticed that I had missed this email. Better to get an answer
late than never...

>>>>> "Paul" == Paul McCullagh <paul.mccullagh@stripped>
> writes:

Paul> Hi Vyacheslav,
Paul> The engine is responsible for deallocating the buffer.

Paul> However, it is not entirely obvious (to me anyway) exactly when it is  
Paul> safe to do this.

MySQL assumes that the buffer is not freed as long as the current
row is active.  The buffer used for a blob can be freed:

- At next read-row with the same TABLE object.
- At ha_rnd_end() or ha_index_end().

Paul> I recommend making the buffer local to the handler. As far as I know,  
Paul> you will need a maximum of one buffer per BLOB column per handler.

MyISAM uses one buffer for all blobs in the current row.

Paul> At the end of the index scan or table scan you can free the buffers  
Paul> for the handler.

Yes.  You can however realloc/free the buffer also at each read_row.

Regards,
Monty
Thread
BLOB memory deallocation (storage engine dev)Vyacheslav Akhmechet11 May
  • Re: BLOB memory deallocation (storage engine dev)Paul McCullagh11 May
    • Re: BLOB memory deallocation (storage engine dev)Vyacheslav Akhmechet11 May
      • Re: BLOB memory deallocation (storage engine dev)Paul McCullagh11 May
        • Re: BLOB memory deallocation (storage engine dev)Vyacheslav Akhmechet11 May
      • Re: BLOB memory deallocation (storage engine dev)Michael Widenius5 Jun
    • Re: BLOB memory deallocation (storage engine dev)Michael Widenius5 Jun