1

I was studying about how and how much memory allocated to each connection thread and found below MySQL tutorial:

http://dev.mysql.com/doc/refman/5.1/en/memory-use.html

There is a point mentioned as below which I am unable to understand.

  • When a thread is no longer needed, the memory allocated to it is released and returned to the system unless the thread goes back into the thread cache. In that case, the memory remains allocated.

My concerns are the following:

  • Does it mean thread occupied the memory even system is using threads from cache?
  • A cache in thread still use memory?
asked Oct 1, 2014 at 15:37

1 Answer 1

1

I wrote these posts

and discussed the many buffers that are allocated for each connection. They are part of RAM and not encapsulated within the cache. Since the buffers are set based whether it is defined in my.cnf or defaulted if it is not, it would not make sense that the memory is released if a thread needs to be reused and will set its buffers to the same sizes again. As I mentioned in How costly is opening and closing of a DB connection? it would be an expensive operation to deallocate and then immediately allocate the buffers.

Therefore, with regard to your actual questions

Does it mean thread occupied the memory even system is using threads from cache?

A cache in thread still use memory?

The answer to both would be Yes

answered Oct 1, 2014 at 17:33
1
  • Perfect as usual. Commented Oct 2, 2014 at 4:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.