---
title: "Discussion on \"Implementing Garbage Collection In C\" | Hashnode"
description: "Discussion on \"Implementing Garbage Collection In C\". How to free all allocated memory and prevent memory leaks 🌬️"
url: "https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Implementing Garbage Collection In C](https://mcsavvy.hashnode.dev/implementing-garbage-collection-in-c?utm_source=hashnode&utm_medium=feed)

How to free all allocated memory and prevent memory leaks 🌬️

Nov 23, 2022 · 6 min read · mcsavvy.hashnode.dev  
Read the article

-   [#garbagecollection](https://hashnode.com/tag/garbagecollection)
-   [#c](https://hashnode.com/tag/c)
-   [#cpp](https://hashnode.com/tag/cpp)
-   [#memory-management](https://hashnode.com/tag/memory-management)

## Written by

[David John](https://hashnode.com/@mcsavvy)

@mcsavvy · Lagos, Nigeria

  
[View profile](https://hashnode.com/@mcsavvy)

I am creator - turning lines of code into bridges of possibility.

Professional Biography: In the technology realm, others see code. I see art. My journey as a software engineer is fueled by a steadfast conviction in the power of creativity to transform our world and the ability of technology to unleash human potential. As a self-taught developer from Nigeria, I have taken a unique route fueled by a constant inquiry and an insatiable thirst for invention. I spent my five years as a developer growing from a lone learner to a versatile full-stack developer and enthusiast for artificial intelligence. Today, my technological landscape spans web development, artificial intelligence, and blockchain technologies, each established through learning about multiple frameworks. Technical Skills: In terms of technical skills, I possess a broad breadth and depth. I know multiple programming languages - Python, JavaScript, Ruby, and C - and possess exceptional knowledge of multiple web technologies - React, Next.js, Node.js, Django, and upcoming frameworks. When I approach code development, I don't just think of it as code. I think of it as compositions. Each line of code is like a musical note bringing functionality together to create a symphony. Professional Philosophy: More than skills, I have a vision to create opportunities. Having seen dauntless ambition and unmet creativity in uninviting environments, I believe technology has the possibility of leveling the playing field. I find coding far more relevant than code; to me, it's about giving people a chance to unearth their expression and potential. Current Frontiers: I'm currently digging deep into the intersections of AI, web development and blockchain technologies. My excitement surrounding cryptocurrencies and programmable assets stems from a mindset I have toward a more fluid, easier to access digital ecosystem. I view these technologies as tools for innovation rather than things that are far off in the future.

## Responses 5

Markdown supported · ⌘↵ to post

[Vela Lim](https://hashnode.com/@velalim)

[Mar 10, 2023](https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716/comment/640adff3e3de6419e7485041)

Excellent Blog

[Afam Ugwuanyi](https://hashnode.com/@Phyro)

[Nov 24, 2022](https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716/comment/637f6d7ae391b6dfe6538892)

That's a very nice implementation. It takes care of malloc and free all at once so that you don't have to keep track of the malloced memory but what happens when someone deletes a memory in the list and that memory is no more accessible. Then won't the whole structure come apart and create even bigger leaks?

[David John](https://hashnode.com/@mcsavvy)

[Nov 24, 2022](https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716/comment/637f6d7ae391b6dfe6538892#reply-637f81aad25c5ee451788bae)

Bro, in C, there are so many ways to break a program if you're a little intention about doing it. That person better be careful.

[David John](https://hashnode.com/@mcsavvy)

[Nov 24, 2022](https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716/comment/637f5fd50d2fc8df7adde8fe)

Okay I'll make a video on it. But before then, what part did you not understand?

[Divine-favour Ojo](https://hashnode.com/@DivineTech)

[Nov 24, 2022](https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716/comment/637f5f3c0d2fc8df7adde8bc)

Thanks, but Somethings are still not clear I'll appreciate if you can explain to me through a live video

[Abdullah Ismail](https://hashnode.com/@Torbary)

[Nov 24, 2022](https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716/comment/637ebca5d7d9bcd845995f52)

Dave, nice content. Have you ever code in C before you joined Alx?

[David John](https://hashnode.com/@mcsavvy)

[Nov 24, 2022](https://hashnode.com/posts/implementing-garbage-collection-in-c/637ea89825817f76a27be716/comment/637ebca5d7d9bcd845995f52#reply-637ebdcfd7d9bcd845995f91)

No I didn't even know what C looked like till I joined ALX.
