Contract weekly report #61 | Haiku Project

Hello there!

As you may have noticed if you watch the commit list closely, my libbind work has not been merged yet. There are still some bugs to solve there, but I got sidetracked. I use BReferenceable in my DNS cache implementation to keep track of the cache entries. BReferenceable is a class used in Haiku to implement reference counted objects. In C++, the language only has very simple memory management, in the form of the new and delete operators. Objects can be allocated on the stack (they are temporary and only last as long as the function they are declared in is executing), or on the heap (for long lived objects). Objects allocated on the stack are deleted automatically when the function exits, while objects allocated on the heap must be deleted manually. This is one of the annoying parts of C++: managing the lifetime of these objects, making sure they are deleted only once, and that no one will try to use them after deletion. In languages such as Java, object deletion is managed by a “garbage collector”: this is a specific piece of code that looks for unused objects and releases their memory. It completely removes the need for the programmer to handle memory allocation and release. This solution has some limitations and is not easily applicable to C++ in a generic way.


This is a companion discussion topic for the original entry at https://www.haiku-os.org/blog/pulkomandy/2015-01-30_contract_weekly_report_61/