fluffos/docs/efun/internals/debugmalloc.md

27 lines
695 B
Markdown
Raw Permalink Normal View History

2018-12-30 16:43:04 -08:00
---
title: internals / debugmalloc
---
2023-11-25 09:50:24 -08:00
# debugmalloc
2018-12-30 16:43:04 -08:00
### NAME
2018-12-30 16:59:01 -08:00
debugmalloc() - dumps information on malloc'd memory to a file.
2018-12-30 16:43:04 -08:00
### SYNOPSIS
docs/efun: document FFI + dwlib efuns, fix return-type errors, drop stale docs Reviewed every efun doc against the .spec source of truth (the make_func declarations) and the implementations. New docs for 28 previously-undocumented efuns: - package_ffi (18): new docs/efun/ffi/ category — ffi_load/unload/symbol/ prepare/call, alloc/free/sizeof/peek/address/read/write, struct_layout, callback/callback_addr/callback_free, error/status. - package_dwlib (10, under contrib/): add_a, vowel, replace, replace_dollars/html/mxp/objects, roulette_wheel, query_multiple_short, reference_allowed. Return-type fixes where the doc contradicted the spec/impl (mostly stale MudOS behavior): cache_stats/debugmalloc/dump_file_descriptors/ malloc_status/mud_status return string; disable_commands/flush_messages/ receive/set_heart_beat are void; get_char/input_to/link/set_eval_limit return int; call_stack -> mixed *, function_profile -> mapping *. Also corrected receive's and disable_commands' stale "returns ..." prose. Expanded implode (function-fold form) and save_object (save-to-string form), both of which the docs had omitted. Removed 4 stale docs for efuns that no longer exist (no spec entry, no f_ implementation, zero references anywhere): errorp, opcprof, swap, dump_socket_status. Regenerated the affected efun index pages. The Docusaurus build passes with onBrokenLinks:throw, confirming no dangling links. Note: the docs/zh-CN translated tree still mirrors the old English docs (same stale entries, and it lacks the new efuns); left for a separate translation pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 16:03:27 -07:00
string debugmalloc( string filename, int mask );
2018-12-30 16:43:04 -08:00
### DESCRIPTION
2018-12-30 16:59:01 -08:00
2018-12-30 16:43:04 -08:00
This efun is only available when DEBUGMALLOC and DEBUGMALLOC_EXTENSIONS
are both defined in options.h at driver build time. The debugmalloc()
efun will dump information on those chunks of memory allocated by DMAL
LOC() and related macros if the mask bitwise and'd (&) with the tag
supplied by the macro (i.e. (mask & tag)) is non-zero. Read md.c and
config.h in the driver source for more information.
### SEE ALSO
2018-12-30 16:59:01 -08:00
set_malloc_mask(3)