]> git.ipfire.org Git - thirdparty/bird.git/blame - lib/resource.sgml
Fininshing integrated OSPF.
[thirdparty/bird.git] / lib / resource.sgml
CommitLineData
5cc1e1f8
MM
1<!--
2 BIRD Programmer's Guide: Resources
3
4 (c) 2000 Martin Mares <mj@ucw.cz>
5-->
6
7<chapt>Resources
8
9<sect>Introduction
10
11<p>Most large software projects implemented in classical procedural
12programming languages usually end up with lots of code taking care
13of resource allocation and deallocation. Bugs in such code are often
14very difficult to find, because they cause only `resource leakage',
15that is keeping a lot of memory and other resources which nobody
16references to.
17
18<p>We've tried to solve this problem by employing a resource tracking
19system which keeps track of all the resources allocated by all the
20modules of BIRD, deallocates everything automatically when a module
725270cb 21shuts down and it is able to print out the list of resources and
5cc1e1f8
MM
22the corresponding modules they are allocated by.
23
58f7d004 24<p>Each allocated resource (from now we'll speak about allocated
5cc1e1f8
MM
25resources only) is represented by a structure starting with a standard
26header (struct <struct/resource/) consisting of a list node (resources are
27often linked to various lists) and a pointer to <struct/resclass/ -- a resource
28class structure pointing to functions implementing generic resource
29operations (such as freeing of the resource) for the particular resource
30type.
31
32<p>There exist the following types of resources:
33
34<itemize>
35<item><it/Resource pools/ (<struct/pool/)
36<item><it/Memory blocks/
37<item><it/Linear memory pools/ (<struct/linpool/)
38<item><it/Slabs/ (<struct/slab/)
5cc1e1f8 39<item><it/Events/ (<struct/event/)
5cc1e1f8 40<item><it/Timers/ (<struct/timer/)
525fa2c1 41<item><it/Sockets/ (<struct/socket/)
5cc1e1f8 42</itemize>