MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | CONCEPT |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 2 | memory / swapping |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
| 4 | DESCRIPTION |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 5 | TODO: This is out of date. Also document the relation with reset |
| 6 | |
| 7 | (Collected from the Changelogs of the driver source) |
| 8 | |
| 9 | The swapping algorithm has been changed. A test is done for |
| 10 | every object, comparing to a time stamp. If the object hasn't |
| 11 | been touched for a while, it could be subject for swapping. |
| 12 | Here comes the new thing: the function 'clean_up()' will be |
| 13 | called in the object. If the object still remains, the old |
| 14 | swapping algorithm will continue. That means that objects that |
| 15 | would never be subject to swapping (cloned objects) now have a |
| 16 | chance to self-destruct. It also means that rooms that |
| 17 | contains no important data can self-destruct. Self-destruction |
| 18 | saves more memory than swapping, as swapping only frees the |
| 19 | program code, while self-destruction also frees the internal |
| 20 | object representation. |
| 21 | |
| 22 | The call of clean_up() has been modified. There is a constant |
| 23 | in config.h that defines how long time until clean_up is |
| 24 | called in an object. This call is independent of reset() and |
| 25 | swapping. It is recommended that the swapping time is |
| 26 | something short, like 10 minutes to 30 minutes, while the time |
| 27 | to clean_up is longer. |
| 28 | |
| 29 | Fixed several bugs in the swap/reset/clean_up logic. |
| 30 | Recommended values are that the swap time is short (less than |
| 31 | 30 minutes), and that reset time is medium (aprox 60 minutes), |
| 32 | and that time to clean_up is long (greater than 1.5h hours). |
| 33 | Any feedback of how to best tune these values are welcome. The |
| 34 | call of reset will be done once, and not yet again until the |
| 35 | object has been touched. This enables reset'ed objects to stay |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 36 | swapped out. If you have a mudlib that has no objects that |
| 37 | define 'clean_up', then you may better define this time as 0, |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 38 | which means never call clean_up (and thus never swap the |
| 39 | object in needlessly). A well implemented usage of clean_up is |
| 40 | better than the swap algorithm, as even cloned objects can be |
| 41 | cleaned up and a self destruction is more efficient than |
| 42 | swapping (memory wise). |
| 43 | |
| 44 | Changed mechanism of calling clean_up() slightly. Only objects |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 45 | that define the function will be called. And, only clean_up() |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 46 | that returns non-zero will be called again. This will minimize |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 47 | calls of clean_up(), while still costing little to maintain. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 48 | |
| 49 | clean_up() now gets a flag as argument, which will be non-zero |
| 50 | if the the program of this object is used for inheritance by |
| 51 | other objects. |
| 52 | |
| 53 | SEE ALSO |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 54 | clean_up(A), slow_shut_down(M), quota_demon(M), low_memory(M) |
| 55 | malloc(D), garbage_collection(E) |