Mauricio Chirino

39%
Flag icon
The basic pattern for resource allocation can be extended for routines that need more than one resource at a time. There are just two more suggestions: Deallocate resources in the opposite order to that in which you allocate them. That way you won’t orphan resources if one resource contains references to another. When allocating the same set of resources in different places in your code, always allocate them in the same order. This will reduce the possibility of deadlock.
The Pragmatic Programmer: Your Journey to Mastery, 20th Anniversary Edition
Rate this book
Clear rating
Open Preview