20,741
edits
No edit summary |
mNo edit summary |
||
| Line 1: | Line 1: | ||
{{Main article|How the Nasal GC works}} | {{Main article|How the Nasal GC works}} | ||
{{Stub}} | {{Stub}} | ||
== Introduction | |||
The focus of the following article is to promote a better understanding of garbage collection in general, specifically mark/sweep collectors and how a generational garbage collector (GC) could be implemented in FlightGear by adapting the existing mark/sweep collector. | The focus of the following article is to promote a better understanding of garbage collection in general, specifically mark/sweep collectors and how a generational garbage collector (GC) could be implemented in FlightGear by adapting the existing mark/sweep collector. | ||
The goal is not to create a new GC implementation from scratch, but rather to understand and improve upon the existing GC scheme to make it more efficient. | The goal is not to create a new GC implementation from scratch, but rather to understand and improve upon the existing GC scheme to make it more efficient. | ||
=== Understanding GCC === | |||
It is important to emphasize that the very first steps in improving the garbage collection (GC) performance in Nasal should be to fully understand the existing GC implementation. This means studying the existing GC code, understanding how it works, and identifying its strengths and weaknesses. Only by thoroughly understanding the existing GC can we begin to make informed decisions about how to improve it. | It is important to emphasize that the very first steps in improving the garbage collection (GC) performance in Nasal should be to fully understand the existing GC implementation. This means studying the existing GC code, understanding how it works, and identifying its strengths and weaknesses. Only by thoroughly understanding the existing GC can we begin to make informed decisions about how to improve it. | ||
=== Exposing GC Internals === | |||
Once the existing GC has been fully understood, the next step should be to make the internals of the GC more accessible. This could involve adding more debugging information, providing more detailed logs, or exposing more internal data to external tools. This will make it easier to diagnose GC-related issues and identify potential areas for improvement. | Once the existing GC has been fully understood, the next step should be to make the internals of the GC more accessible. This could involve adding more debugging information, providing more detailed logs, or exposing more internal data to external tools. This will make it easier to diagnose GC-related issues and identify potential areas for improvement. | ||
=== Implementing a Generational GC === | |||
Only after these first two steps have been taken should we consider implementing generational GC support in Nasal. | Only after these first two steps have been taken should we consider implementing generational GC support in Nasal. | ||
The idea is that implementing a generational GC, which is a type of GC that separates objects into different generations based on how long they have been in memory, could improve the performance of the GC in Nasal/FlightGear. | The idea is that implementing a generational GC, which is a type of GC that separates objects into different generations based on how long they have been in memory, could improve the performance of the GC in Nasal/FlightGear. | ||
=== Supporting alternate GCs === | |||
The following article also suggests that generalizing the interface of the existing GC would make it easier to experiment with other GCs, such as the Boehm/Weiser GC or sgen. Given that some GC implementations are only available in C++, it might make sense to port Nasal to compile as C++ code (which would have other benefits too). | The following article also suggests that generalizing the interface of the existing GC would make it easier to experiment with other GCs, such as the Boehm/Weiser GC or sgen. Given that some GC implementations are only available in C++, it might make sense to port Nasal to compile as C++ code (which would have other benefits too). | ||
| Line 28: | Line 33: | ||
Additionally, using an existing GC allows you to take advantage of the expertise and knowledge of the GC developers, who have likely spent a great deal of time optimizing and improving the GC. This can save you a significant amount of time and effort, and can help you avoid common pitfalls and mistakes that are often made when developing a new GC. | Additionally, using an existing GC allows you to take advantage of the expertise and knowledge of the GC developers, who have likely spent a great deal of time optimizing and improving the GC. This can save you a significant amount of time and effort, and can help you avoid common pitfalls and mistakes that are often made when developing a new GC. | ||