What is garbage collection

The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we solve previous year question papers for you.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions

PHP-->View question

What is garbage collection?

its about What is garbage collection


Asked On2019-09-06 15:46:36 by:Annaliya

Taged users:


Likes:
Be first to like this question

Dislikes:
Be first to dislike this question
Talk about this  Like  Dislike
View all qusetions
Answers
Garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program

Answerd on:2019-09-09 Answerd By:Ananth

Likes:
|Ananth

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Network and IP Address
Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here

When you allocate a variable in PHP, internally it will hold a special counter for that variable called a reference count. It’s a simple counter that keeps track on how many times that variable is used. For instance if you instantiate a class and assign in to a variable $foo, the reference count for that class will become 1. If you do: "$bar = $foo", it means that both the variables $bar and $foo will reference your class and its reference-count becomes 2. When we do $foo = 1; afterwards, PHP sees that $foo doesn’t reference to your class anymore, and decreases the reference count again.

This is extremely handy to figure out quickly if PHPs data like variables, or big classes etc, is being referenced or not. If it doesn’t have any references, PHP can actually free the memory from that variable. This way it can keep your memory usage as low as possible and you this way you are able to use lots of variables throughout your application without using tons of memory. The process of freeing up memory when no references are found is called garbage collection (GC).


Answerd on:2019-09-09 Answerd By:Tanisha-Garg

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Network and IP Address
Watch more here

Watch more videos from this user Here

Learn how to upload a video and start earning here



Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder