Jan-Lukas Else

Tech, life and everything else

Published on in 💬 Micro
Updated on
Short link: https://b.jlel.se/s/773
Share this post
⚠️ This entry is already over one year old. It may no longer be up to date. Opinions may have changed.

It took me so long to find the cause of a memory leak in GoBlog. I thought it was smart to use a cache for prepared database statements. But I didn’t read the documentation and didn’t know that prepared statements need to be closed when they are no longer needed to free up the allocated resources. 🤦‍♂️ I finally fixed it by removing the prepared statement cache altogether. Less code, fewer problems in the future, and the cache wasn’t much of an improvement anyway. I also learned about the usefulness of memory profiling.

Tags:

Jan-Lukas Else
Interactions & Comments