# memory usage and the thread cache

**URL:** <https://forums.percona.com/t/memory-usage-and-the-thread-cache/746>\
**Category:** Other MySQL® Questions\
**Created:** [May 3, 2008, 8:42am UTC](https://forums.percona.com/t/memory-usage-and-the-thread-cache/746 "2008-05-03T08:42:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrabbit](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jrabbit](https://forums.percona.com/u/jrabbit)\
**Post date:** [May 3, 2008, 8:42am UTC](https://forums.percona.com/t/memory-usage-and-the-thread-cache/746/1 "2008-05-03T08:42:59Z")

</div>

I’m trying to get a better understanding of thread memory usage. Assuming the following buffers were allocated during a query, and the thread is to be returned to the thread cache rather than closed at the end of the query. If they were used, are the following buffers kept allocated, or are they released before the thread is put in the cache?

1. The thread stack (I think this stays allocated)
2. The connection buffer (This may be released or shrunk?)
3. The result buffer (This may be released or shrunk?)
4. The read\_buffer
5. The read\_rnd\_buffer
6. The sort\_buffer
7. The myiasm\_sort\_buffer
8. The bulk\_insert\_buffer
9. The binlog cache buffer

Thanks for any assistance.

---

<div class="post-metadata">

**Author:** ![debug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/debug/32/772_2.png) [@debug](https://forums.percona.com/u/debug)\
**Post date:** [May 14, 2008, 3:56am UTC](https://forums.percona.com/t/memory-usage-and-the-thread-cache/746/2 "2008-05-14T03:56:54Z")

</div>

Have you seen this blog post? [http://www.mysqlperformanceblog.com/2006/05/17/mysql-server-](http://www.mysqlperformanceblog.com/2006/05/17/mysql-server-) memory-usage/  
It explains MySQL memory usage
