---
title: "Discussion on \"Garbage Collection is slowing down your code\" | Hashnode"
description: "Discussion on \"Garbage Collection is slowing down your code\". Garbage collection slows down your code"
url: "https://hashnode.com/posts/garbage-collection-is-slowing-down-your-code/635427b26f1409587a2a4725"
---

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

Discussion

# [Garbage Collection is slowing down your code](https://wishall.hashnode.dev/garbage-collection-is-slowing-down-your-code?utm_source=hashnode&utm_medium=feed)

Garbage collection slows down your code

Oct 22, 2022 · 3 min read · wishall.hashnode.dev  
Read the article

-   [#programming](https://hashnode.com/tag/programming)
-   [#garbagecollection](https://hashnode.com/tag/garbagecollection)
-   [#betterdeveloper](https://hashnode.com/tag/betterdeveloper)
-   [#efficiency](https://hashnode.com/tag/efficiency)

## Written by

[Vishal Arora](https://hashnode.com/@wishall)

@wishall · Bengaluru, India

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

I write code...

I am Software Developer from Bengaluru, Inidia.

## Responses 2

Markdown supported · ⌘↵ to post

[Maxi Contieri](https://hashnode.com/@mcsee)

[Oct 22, 2022](https://hashnode.com/posts/garbage-collection-is-slowing-down-your-code/635427b26f1409587a2a4725/comment/6354831048f6ebd7a37ed0ed)

Does it happen on every system or just from performance critical ones?

[Vishal Arora](https://hashnode.com/@wishall)

[Oct 23, 2022](https://hashnode.com/posts/garbage-collection-is-slowing-down-your-code/635427b26f1409587a2a4725/comment/6354831048f6ebd7a37ed0ed#reply-6355340731a9a1e09b693a8e)

It does not depend on system but rather the programming language. All modern languages have some form of garbage collector implemented and will face this issue.

[sandeep negi](https://hashnode.com/@sandeepnegi1996)

[Oct 22, 2022](https://hashnode.com/posts/garbage-collection-is-slowing-down-your-code/635427b26f1409587a2a4725/comment/6354330ab29017d65cd63822)

thanks for sharing man , but most of the time garbage collection is pretty fast in Java and usually i make sure create object and variables in a scope so that once they become out of scope it will be available for garbage collection need to try the source code shared by you , and love the intro bro ;)

[Vishal Arora](https://hashnode.com/@wishall)

[Oct 22, 2022](https://hashnode.com/posts/garbage-collection-is-slowing-down-your-code/635427b26f1409587a2a4725/comment/6354330ab29017d65cd63822#reply-635438a0b29017d65cd638d1)

it depends on the programming language as well as the size of the source code. Java's garbage collection is faster as compared to others. But I would suggest instead of making the objects and variables available for garbage collection, use a centralized pool and release this variable into that pool, so that other parts of the program can re-use the memory. If you want to see how much time is being taken by the garbage collector in your program, you can use the profiling tab to check in the Chrome's developer tools.
