Skip to main content
gamedev.net
🔒 Locked

Garbage collection?!?!?

Started by snyp 4 replies 1.7k views
Original Post
snyp
snyp
do you think that pointers and memory management will be completly wiped out by garbage collection?!
Actual Linux penguins were harmed in the making of this message.
Sneftel
Sneftel
Completely? No.

Garbage collection, and direct management through new and delete, are opposite ends of the spectrum with regards to having the programmer specify everything, versus having the runtime figure everything out. I think that next generation memory management systems will be a hybrid of the two techniques, with language hooks allowing programmers to specify ownership semantics in specific-enough ways that the compiler and the runtime can work together to maximize both performance and ease of development.


"Sneftel is correct, if rather vulgar." --Flarelocke
Shannon Barber
Shannon Barber
If they would just let you explicitly destroy something and allow stack instances there'd be no issues to resolve. 'course you could delete something still in use then, and that'd be too dangerous... and also inconsistent.

Garbage collection is very non-deterministic so it is unacceptable for an entire classification of programs that assembly, Ada, Fortran, C, and C++ are commonly used for.

I would expect all new languages to implement some form garbage collection, unless someone designs a new language for real-time programming.

[edited by - Magmai Kai Holmlor on May 12, 2004 11:45:05 PM]
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
ironfroggy
ironfroggy
there is something most people either dont realize or just choose to ignore: ''manually'' allocating and freeing memory (new and delete in C++) is _not_ the lowest level available. those are functions you call, and those functions are doing something when you aren''t looking. Internally, a list of memory blocks is stored, flagging them as free or used. When you delete some memory, the block is found in the list and flagged as free. When you allocate new memory, the list of searched for a free block of sufficiant size (or multiple, consecutive blocks of a sufficient total size, if the system doesnt join such consectutive free blocks). Of course, bring virtual memory into mix adds some more complexity, monitoring when a page is needed and when all its memory is free and it can be removed.

What is the point of all this? You didn''t know about it, probably. You most likely thought that the new and delete keywords were the lowest level of memory management, but that isn''t so.

I don''t think the new/delete mechanism will disappear, but I hope that someday it is reserved only for kernels and high-end hardware drivers.
(http://www.ironfroggy.com/)(http://www.ironfroggy.com/pinch)
JohnBolton
JohnBolton
I have no doubt that garbage collection will eventually take over, but I don''t think manual memory managment will go away completely. It will still be needed for a few special circumstances.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
gommo
gommo
quote:
Original post by ironfroggy
What is the point of all this? You didn't know about it, probably. You most likely thought that the new and delete keywords were the lowest level of memory management, but that isn't so.


I'm guessing a lot of people on this board knew that they aren't the lowest level available.


The thing I find about garbage collected languages such as Java and C# is that inexperienced programmers using those languages think they are memory leak free! When in fact it is so easy, especially in large Java applications, to write code that has dangling references around. Of course, when you exit the application the memory is freed, but most OS's will do that with C++ programms too.

People learning Java should read 'Effective Java' as its got some great tips to do with memory management. I went through uni and learnt Java and I swear the lecturers thought Java was the best thing out and did all the dirty work for them. As a result, most people graduating think Java doesnt leak memory. What a crock!



[edited by - gommo on May 13, 2004 3:11:32 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.