memory Emacs is currently using.
@defun memory-limit
-This function returns the address of the last byte Emacs has allocated,
-divided by 1024. We divide the value by 1024 to make sure it fits in a
-Lisp integer.
-
+This function returns an estimate of the total amount of bytes of
+virtual memory that Emacs is currently using, divided by 1024.
You can use this to get a general idea of how your actions affect the
memory usage.
@end defun
instead of just Microsoft platforms. This fixes a 'get-free-disk-space'
bug on OS X 10.8 and later (Bug#28639).
++++
+** 'memory-limit' now returns a better estimate of memory consumption.
+
+++
** New macro 'combine-change-calls' arranges to call the change hooks
('before-change-functions' and 'after-change-functions') just once
(set-process-plist process
(plist-put (process-plist process) propname value)))
+(defun memory-limit ()
+ "Return an estimate of Emacs virtual memory usage, divided by 1024."
+ (or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0))
+
\f
;;;; Input and display facilities.
/* Debugging aids. */
-DEFUN ("memory-limit", Fmemory_limit, Smemory_limit, 0, 0, 0,
- doc: /* Return the address of the last byte Emacs has allocated, divided by 1024.
-This may be helpful in debugging Emacs's memory usage.
-We divide the value by 1024 to make sure it fits in a Lisp integer. */)
- (void)
-{
- Lisp_Object end;
-
-#if defined HAVE_NS || defined __APPLE__ || !HAVE_SBRK
- /* Avoid warning. sbrk has no relation to memory allocated anyway. */
- XSETINT (end, 0);
-#else
- XSETINT (end, (intptr_t) (char *) sbrk (0) / 1024);
-#endif
-
- return end;
-}
-
DEFUN ("memory-use-counts", Fmemory_use_counts, Smemory_use_counts, 0, 0, 0,
doc: /* Return a list of counters that measure how much consing there has been.
Each of these counters increments for a certain kind of object.
defsubr (&Smake_finalizer);
defsubr (&Spurecopy);
defsubr (&Sgarbage_collect);
- defsubr (&Smemory_limit);
defsubr (&Smemory_info);
defsubr (&Smemory_use_counts);
defsubr (&Ssuspicious_object);