diff options
Diffstat (limited to 'src/alloc.c')
-rw-r--r-- | src/alloc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index ead83fe0fb4..dcdbd65d85e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2010,6 +2010,25 @@ compact_strings () } } +/* Debugging aids. */ + +DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, "", + "Return the address of the last byte Emacs has allocated, divided by 1024.\n\ +This may be helpful in debugging Emacs's memory usage.\n\ +If called interactively, print the result in the minibuffer.") + () +{ + Lisp_Object end; + + XSET (end, Lisp_Int, (int) sbrk (0)); + + if (! NILP (Finteractive_p)) + message ("Memory limit at %dk.", XINT (end)); + + return end; +} + + /* Initialization */ init_alloc_once () @@ -2100,4 +2119,5 @@ which includes both saved text and other data."); defsubr (&Smake_marker); defsubr (&Spurecopy); defsubr (&Sgarbage_collect); + defsubr (&Smemory_limit); } |