MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 2 | void garbage_collection() |
| 3 | void garbage_collection(string filename) |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 4 | void garbage_collection(string filename, int flag) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 5 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 6 | DESCRIPTION |
| 7 | Tell the parser to initiate a garbage collection after the |
| 8 | current execution ended. Depending on the type of memory |
| 9 | allocator used, this GC is more less thorough. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 10 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 11 | If the 'smalloc' memory allocator is used, the GC produces |
| 12 | output to a log file. The default name of the log file is |
| 13 | specified at program start, but can be modified at runtime: |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 14 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 15 | With the <filename> argument a log file for the GC output |
| 16 | different from the default log file can be specified. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 17 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 18 | If <flag> is not given or 0, the output from the next |
| 19 | and only the next GC will go into the log file. If the file |
| 20 | already exists, the new output will be appended. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 21 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 22 | If <flag> is 1, the <filename> will be used as the new |
| 23 | default log file for all following GCs. If the file already |
| 24 | exists, it will be overwritten from the start. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 25 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 26 | If a different memory allocator is used, the GC does not produce |
| 27 | output and the <filename> and <flag> arguments are ignored. |
| 28 | |
| 29 | Calling this efun causes a privilege_violation. |
| 30 | |
| 31 | EXAMPLES |
| 32 | garbage_collection() |
| 33 | [ GC occurs -> logs into default file ] |
| 34 | |
| 35 | garbage_collection("/GCLOG") |
| 36 | [ GC occurs -> logs into "/GCLOG" ] |
| 37 | |
| 38 | garbage_collection("/GCLOG", 1) |
| 39 | [ GC occurs -> logs into "/GCLOG", sets default log to "/GCLOG" ] |
| 40 | |
| 41 | garbage_collection("/GCLOG") |
| 42 | garbage_collection("/GCLOG2") |
| 43 | [ GC occurs -> logs into "/GCLOG" ] |
| 44 | |
| 45 | garbage_collection("/GCLOG", 1) |
| 46 | garbage_collection("/GCLOG2") |
| 47 | [ GC occurs -> logs into "/GCLOG2", sets default log to "/GCLOG" ] |
| 48 | |
| 49 | HISTORY |
| 50 | LDMud 3.2.9 added the <filename> argument. |
| 51 | LDMud 3.3.209 added the <flag> argument. |
| 52 | LDMUd 3.5.0 made the efun privileged. |
| 53 | |
| 54 | SEE ALSO |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 55 | rusage(E), valid_write(M), privilege_violation(M) |