From 20d2471455526acfd5fe96681ea31f0eac88fae4 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sat, 3 Oct 1992 08:36:49 +0000 Subject: * alloc.c (Fmemory_limit): New function. (syms_of_alloc): Defsubr it. --- src/alloc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index ead83fe0fb..dcdbd65d85 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2009,6 +2009,25 @@ compact_strings () from_sb = to_sb; } } + +/* 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 */ @@ -2100,4 +2119,5 @@ which includes both saved text and other data."); defsubr (&Smake_marker); defsubr (&Spurecopy); defsubr (&Sgarbage_collect); + defsubr (&Smemory_limit); } -- cgit v1.2.3