Thursday, 1 March 2007

MySQL University, MEM_ROOT and Pillows

I'm listening to the first MySQL University session. It's the highest form of education available at MySQL AB, hence the name. Not about how to use MySQL, but how to write code patches for MySQL.

Right now, Sergei Golubchik is sitting in Cologne, Germany, speaking behind Skype Conferencing and two pillows (sound quality!) about memory management and mysys libraries and algorithms. Monty and others are assisting Sergei over our internal IRC, where there are 31 developers listening in.

Our presenter, Sergei Golubchik, in a non-virtual setting

Here's an IRC transcript:

monty|uni ie, only destructior is called, memory is not freed until free_root()
rafal|school monty|uni: if I initialize String from other String, or char table[] or "string constant", is memory allocated/deallocated correctly?
iggy|uni serg, While talking about alloc/dealloc for Strings, could you comment on the usefullness of SAFEMALLOC and how to take advantage of it?
monty|uni rafal|school: should be
rafal|school monty|uni: ok (thanks for all answers)
monty|uni Note that String can be both a pointer (like char*) and a C++ like string that holds the string itself
monty|uni If you use it as a pointer, you don't get it freed. If you use it as a string (or convert it from pointer to string with String.copy(), you need to free it
monty|uni Using delete works on both cases
monty|uni so to be safe, you should just call delete on all String objects.
rafal|school monty|uni: how String can be used as a pointer?
mats|phone monty|uni, So that means that you have to allocate memory for a C string if you are passing it into the String constructor?
monty|uni Default is pointer
monty|uni mats|phone: or you use string.copy()

It's a challenge. I'm not talking about understanding the routines, like

  • init_alloc_root() - Initalize a MEMROOT object

  • alloc_root() - Allocate an object

  • multi_alloc_root() - Allocate many objects at once

  • free_root() - Free everything

nor about understanding Serg's accent. Everyone at MySQL has an accent. Our internal language is Bad English, and I feel competent to conform.

The challenge is the low bandwidth. I'm also sitting in Germany, and sadly, it sounds as if Serg were speaking through two pillows.

So why am I writing about this? Because we are planning to open up MySQL University. We are thinking of moving the IRC chat to freenode, and the Wiki pages to the MySQL University Library on MySQL Forge Wiki. The sound already is public, on Skype Conferencing.

With the open MySQL University, those who have an interest in learning about MySQL's internal code structure can listen in, or follow the MP3 recording later on, or just browse the MySQL University Library. Stay tuned -- we hope to be able to open up these weekly sessions later on in March.

No comments:

Post a comment