Skip to main content

Memory Leak & malloc chunks

· 17 min read
Ye Shu
Studying how C++ allocates and frees chunks in memory

How it all started

While debugging a memory leak bug during my summer internship, I found out that one of our APIs returned a raw pointer and thus transferred its ownership to the caller (me). In other words, I'm now responsible of delete-ing the pointer after my code finishes. While this is a terrible engineering practice, I grew interested in how memory leaks happen, and how delete[] solves the problem.

After some research & experiments, I wrote this blog post, which hopefully addresses three sets of questions

  1. What are memory leaks?
  2. How are objects allocated on the heap? How does delete[] know which area of memory to be freed?
  3. How can we prevent memory leaks from happening?

Me and My Broken Site(s)

· 2 min read
Ye Shu
Celebrating the launching of my new website

My personal website is finally up and running today! It is already 821 days after I purchased this domain (huh I'm such big a procrastinator). I also have a blog running on the subdomain blog.shuye.dev for some longer and possibly non tech-related blog posts.

This is not the first personal website I've ever made. I coded my very first personal website in 2014 using static HTML and CSS (that was the time when most websites were still using HTML 4.01 and you had to decide whether you want a "strict" version of HTML), after a bit of self-learning with W3Schools. In fact, I wasn't even learning from the true W3Schools, but an imitation of it.