aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorJan Djärv2004-12-25 10:31:36 +0000
committerJan Djärv2004-12-25 10:31:36 +0000
commitd8f165a83ea0cc5ec18e22bb201d62a058ea71de (patch)
tree78acfaf4e1de3726c34d547d7ce465c626feeab4 /src/alloc.c
parent857ae68b96103b3a8a7116f8d14a13d1623be4d5 (diff)
downloademacs-d8f165a83ea0cc5ec18e22bb201d62a058ea71de.tar.gz
emacs-d8f165a83ea0cc5ec18e22bb201d62a058ea71de.zip
Update comment for check_depth.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 143f5c76292..429cdb5246a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -601,22 +601,24 @@ static char xmalloc_overrun_check_trailer[XMALLOC_OVERRUN_CHECK_SIZE] =
601 ((unsigned)(ptr[-4]) << 24)) 601 ((unsigned)(ptr[-4]) << 24))
602 602
603 603
604/* The call depth in overrun_check functions. Realloc may call both malloc 604/* The call depth in overrun_check functions. For example, this might happen:
605 and free. If realloc calls malloc, this may happen: 605 xmalloc()
606 overrun_check_realloc() 606 overrun_check_malloc()
607 -> malloc -> (via hook)_-> emacs_blocked_malloc 607 -> malloc -> (via hook)_-> emacs_blocked_malloc
608 -> overrun_check_malloc 608 -> overrun_check_malloc
609 call malloc (hooks are NULL, so real malloc is called). 609 call malloc (hooks are NULL, so real malloc is called).
610 malloc returns 10000. 610 malloc returns 10000.
611 add overhead, return 10016. 611 add overhead, return 10016.
612 <- (back in overrun_check_realloc) 612 <- (back in overrun_check_malloc)
613 add overhead again, return 10032 613 add overhead again, return 10032
614 xmalloc returns 10032.
614 615
615 (time passes). 616 (time passes).
616 617
617 overrun_check_free(10032) 618 xfree(10032)
618 decrease overhed 619 overrun_check_free(10032)
619 free(10016) <- crash, because 10000 is the original pointer. */ 620 decrease overhed
621 free(10016) <- crash, because 10000 is the original pointer. */
620 622
621static int check_depth; 623static int check_depth;
622 624