Mercurial > hg > xemacs-beta
comparison src/vm-limit.c @ 185:3d6bfa290dbd r20-3b19
Import from CVS: tag r20-3b19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:55:28 +0200 |
parents | 54cc21c15cbb |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
184:bcd2674570bf | 185:3d6bfa290dbd |
---|---|
23 #ifdef emacs | 23 #ifdef emacs |
24 #include <config.h> | 24 #include <config.h> |
25 #include "lisp.h" | 25 #include "lisp.h" |
26 #endif | 26 #endif |
27 | 27 |
28 #include <stddef.h> | |
28 #ifndef emacs | 29 #ifndef emacs |
29 #include <stddef.h> | |
30 typedef size_t SIZE; | 30 typedef size_t SIZE; |
31 typedef void *POINTER; | 31 typedef void *POINTER; |
32 #define EXCEEDS_LISP_PTR(x) 0 | 32 #define EXCEEDS_LISP_PTR(x) 0 |
33 #endif | 33 #endif |
34 | 34 |
50 /* Get more memory space, complaining if we're near the end. */ | 50 /* Get more memory space, complaining if we're near the end. */ |
51 | 51 |
52 static void | 52 static void |
53 check_memory_limits (void) | 53 check_memory_limits (void) |
54 { | 54 { |
55 extern POINTER (*__morecore) (); | 55 extern POINTER (*__morecore) (ptrdiff_t size); |
56 | 56 |
57 POINTER cp; | 57 POINTER cp; |
58 unsigned long five_percent; | 58 unsigned long five_percent; |
59 unsigned long data_size; | 59 unsigned long data_size; |
60 | 60 |
67 data_size = (char *) cp - (char *) data_space_start; | 67 data_size = (char *) cp - (char *) data_space_start; |
68 | 68 |
69 if (warn_function) | 69 if (warn_function) |
70 switch (warnlevel) | 70 switch (warnlevel) |
71 { | 71 { |
72 case 0: | 72 case 0: |
73 if (data_size > five_percent * 15) | 73 if (data_size > five_percent * 15) |
74 { | 74 { |
75 warnlevel++; | 75 warnlevel++; |
76 (*warn_function) ("Warning: past 75% of memory limit"); | 76 (*warn_function) ("Warning: past 75% of memory limit"); |
77 } | 77 } |
78 break; | 78 break; |
79 | 79 |
80 case 1: | 80 case 1: |
81 if (data_size > five_percent * 17) | 81 if (data_size > five_percent * 17) |
82 { | 82 { |
83 warnlevel++; | 83 warnlevel++; |
84 (*warn_function) ("Warning: past 85% of memory limit"); | 84 (*warn_function) ("Warning: past 85% of memory limit"); |
85 } | 85 } |
86 break; | 86 break; |
87 | 87 |
88 case 2: | 88 case 2: |
89 if (data_size > five_percent * 19) | 89 if (data_size > five_percent * 19) |
90 { | 90 { |
91 warnlevel++; | 91 warnlevel++; |
92 (*warn_function) ("Warning: past 95% of memory limit"); | 92 (*warn_function) ("Warning: past 95% of memory limit"); |
93 } | 93 } |
119 also declare where the end of pure storage is. */ | 119 also declare where the end of pure storage is. */ |
120 | 120 |
121 void | 121 void |
122 memory_warnings (void *start, void (*warnfun) (CONST char *)) | 122 memory_warnings (void *start, void (*warnfun) (CONST char *)) |
123 { | 123 { |
124 extern void (* __after_morecore_hook) (); /* From gmalloc.c */ | 124 extern void (* __after_morecore_hook) (void); /* From gmalloc.c */ |
125 | 125 |
126 if (start) | 126 if (start) |
127 data_space_start = start; | 127 data_space_start = start; |
128 else | 128 else |
129 data_space_start = start_of_data (); | 129 data_space_start = start_of_data (); |