/[emacs]/emacs/src/alloc.c
ViewVC logotype

Diff of /emacs/src/alloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.358 by jhd, Sat Dec 25 10:13:57 2004 UTC revision 1.359 by jhd, Sat Dec 25 10:31:36 2004 UTC
# Line 601  static char xmalloc_overrun_check_traile Line 601  static char xmalloc_overrun_check_traile
601             ((unsigned)(ptr[-4]) << 24))             ((unsigned)(ptr[-4]) << 24))
602    
603    
604  /* The call depth in overrun_check  functions.  Realloc may call both malloc  /* The call depth in overrun_check functions.  For example, this might happen:
605     and free.  If realloc calls malloc, this may happen:     xmalloc()
606     overrun_check_realloc()       overrun_check_malloc()
607        -> malloc -> (via hook)_-> emacs_blocked_malloc         -> malloc -> (via hook)_-> emacs_blocked_malloc
608           -> overrun_check_malloc            -> overrun_check_malloc
609              call malloc  (hooks are NULL, so real malloc is called).               call malloc  (hooks are NULL, so real malloc is called).
610              malloc returns 10000.               malloc returns 10000.
611              add overhead, return 10016.               add overhead, return 10016.
612        <- (back in overrun_check_realloc)        <- (back in overrun_check_malloc)
613        add overhead again, return 10032        add overhead again, return 10032
614       xmalloc returns 10032.
615    
616     (time passes).     (time passes).
617    
618     overrun_check_free(10032)     xfree(10032)
619       decrease overhed       overrun_check_free(10032)
620       free(10016)  <-  crash, because 10000 is the original pointer.  */         decrease overhed
621           free(10016)  <-  crash, because 10000 is the original pointer.  */
622    
623  static int check_depth;  static int check_depth;
624    

Legend:
Removed from v.1.358  
changed lines
  Added in v.1.359

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26