annotate src/vm-limit.c @ 83376:de684325b343

Merged in changes from CVS trunk. Patches applied: * lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-6 Update from CVS * lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-7 Sync with miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-539. * lorentey@elte.hu--2004/emacs--cvs-trunk--0--version-0 Branch closed. Use miles@gnu.org--gnu-2005/emacs--cvs-trunk--0 instead. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-475 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-476 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-477 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-478 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-479 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-480 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-481 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-482 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-483 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-484 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-485 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-486 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-487 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-488 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-489 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-490 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-491 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-492 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-493 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-494 Update from CVS: lisp/startup.el (command-line): Fix typo. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-495 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-496 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-497 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-498 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-499 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-500 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-501 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-502 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-504 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-505 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-506 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-507 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-508 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-509 Update from CVS: .cvsignore: Add `lock'. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-510 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-511 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-512 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-513 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-514 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-515 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-516 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-517 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-518 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-519 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-520 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-521 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-522 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-523 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-524 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-525 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-526 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-527 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-528 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-529 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-531 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-532 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-533 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-534 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-535 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-536 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-537 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-538 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-539 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-88 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-89 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-90 Update FSF's address in GPL notices * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-91 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-92 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-93 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-94 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-95 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-96 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-97 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-98 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-99 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-100 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-101 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-102 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-103 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-104 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-105 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-106 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-107 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-108 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-109 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-110 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-111 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-112 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-113 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-114 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-416
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 11 Sep 2005 08:23:50 +0000
parents a0d1312ede66
children 3bd95f4f2941 2d92f5c9d6ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
1 /* Functions for memory limit warnings.
64770
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
2 Copyright (C) 1990, 1992, 2002, 2003, 2004,
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64084
diff changeset
3 2005 Free Software Foundation, Inc.
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
4
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
5 This file is part of GNU Emacs.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
6
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
1398
70d0cd4c5bff mem_limits.h is now called mem-limits.h.
Roland McGrath <roland@gnu.org>
parents: 1392
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10 any later version.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15 GNU General Public License for more details.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
64084
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
20 Boston, MA 02110-1301, USA. */
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
22 #ifdef emacs
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 3935
diff changeset
23 #include <config.h>
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
24 #include "lisp.h"
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
25 #endif
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
26
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
27 #ifndef emacs
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
28 #include <stddef.h>
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
29 typedef size_t SIZE;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
30 typedef void *POINTER;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
31 #define EXCEEDS_LISP_PTR(x) 0
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
32 #endif
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
33
1398
70d0cd4c5bff mem_limits.h is now called mem-limits.h.
Roland McGrath <roland@gnu.org>
parents: 1392
diff changeset
34 #include "mem-limits.h"
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
35
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
36 /*
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
37 Level number of warnings already issued.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
38 0 -- no warnings issued.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
39 1 -- 75% warning already issued.
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
40 2 -- 85% warning already issued.
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
41 3 -- 95% warning issued; keep warning frequently.
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42 */
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43 static int warnlevel;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 /* Function to call to issue a warning;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
46 0 means don't issue them. */
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
47 static void (*warn_function) ();
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
48
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49 /* Get more memory space, complaining if we're near the end. */
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
50
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
51 static void
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
52 check_memory_limits ()
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
53 {
30062
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
54 #ifdef REL_ALLOC
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
55 extern POINTER (*real_morecore) ();
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
56 #endif
1417
3a1576d52874 (check_memory_limits): Declare __morecore.
Roland McGrath <roland@gnu.org>
parents: 1416
diff changeset
57 extern POINTER (*__morecore) ();
3a1576d52874 (check_memory_limits): Declare __morecore.
Roland McGrath <roland@gnu.org>
parents: 1416
diff changeset
58
30062
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
59
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
60 register POINTER cp;
3935
cecc2b59e875 (check_memory_limits): Use unsigned long to hold memory size values.
Richard M. Stallman <rms@gnu.org>
parents: 1417
diff changeset
61 unsigned long five_percent;
cecc2b59e875 (check_memory_limits): Use unsigned long to hold memory size values.
Richard M. Stallman <rms@gnu.org>
parents: 1417
diff changeset
62 unsigned long data_size;
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
63
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
64 if (lim_data == 0)
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65 get_lim_data ();
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
66 five_percent = lim_data / 20;
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
67
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
68 /* Find current end of memory and issue warning if getting near max */
30062
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
69 #ifdef REL_ALLOC
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
70 if (real_morecore)
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
71 cp = (char *) (*real_morecore) (0);
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
72 else
9a026d470bc9 (check_memory_limits) [REL_ALLOC]: Use real_morecore
Andrew Innes <andrewi@gnu.org>
parents: 24366
diff changeset
73 #endif
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
74 cp = (char *) (*__morecore) (0);
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
75 data_size = (char *) cp - (char *) data_space_start;
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
76
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
77 if (warn_function)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
78 switch (warnlevel)
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
79 {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 30062
diff changeset
80 case 0:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
81 if (data_size > five_percent * 15)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
82 {
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
83 warnlevel++;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
84 (*warn_function) ("Warning: past 75% of memory limit");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
85 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
86 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
87
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 30062
diff changeset
88 case 1:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
89 if (data_size > five_percent * 17)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
90 {
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
91 warnlevel++;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
92 (*warn_function) ("Warning: past 85% of memory limit");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
93 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
94 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
95
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 30062
diff changeset
96 case 2:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
97 if (data_size > five_percent * 19)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98 {
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
99 warnlevel++;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
100 (*warn_function) ("Warning: past 95% of memory limit");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
101 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
102 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
103
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
104 default:
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
105 (*warn_function) ("Warning: past acceptable memory limits");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
106 break;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
107 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
108
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
109 /* If we go down below 70% full, issue another 75% warning
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
110 when we go up again. */
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
111 if (data_size < five_percent * 14)
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
112 warnlevel = 0;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
113 /* If we go down below 80% full, issue another 85% warning
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
114 when we go up again. */
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
115 else if (warnlevel > 1 && data_size < five_percent * 16)
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
116 warnlevel = 1;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
117 /* If we go down below 90% full, issue another 95% warning
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
118 when we go up again. */
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
119 else if (warnlevel > 2 && data_size < five_percent * 18)
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
120 warnlevel = 2;
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
121
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
122 if (EXCEEDS_LISP_PTR (cp))
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
123 (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
124 }
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
125
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
126 /* Cause reinitialization based on job parameters;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
127 also declare where the end of pure storage is. */
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
128
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
129 void
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
130 memory_warnings (start, warnfun)
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
131 POINTER start;
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
132 void (*warnfun) ();
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133 {
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
134 extern void (* __after_morecore_hook) (); /* From gmalloc.c */
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
135
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
136 if (start)
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
137 data_space_start = start;
1392
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
138 else
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
139 data_space_start = start_of_data ();
ad64a94cd81c (morecore_with_warning): Reduce warnlevel when usage drops far enough.
Richard M. Stallman <rms@gnu.org>
parents: 734
diff changeset
140
1400
af08281c0cbe (warnfunction): Renamed to warn_function (was used inconsistently).
Roland McGrath <roland@gnu.org>
parents: 1398
diff changeset
141 warn_function = warnfun;
1416
60bb5e719468 (morecore_with_warning): Removed.
Roland McGrath <roland@gnu.org>
parents: 1400
diff changeset
142 __after_morecore_hook = check_memory_limits;
24366
274b79aeb3b7 (memory_warnings) [WINDOWSNT]: Reset lim_data on each
Andrew Innes <andrewi@gnu.org>
parents: 14186
diff changeset
143
274b79aeb3b7 (memory_warnings) [WINDOWSNT]: Reset lim_data on each
Andrew Innes <andrewi@gnu.org>
parents: 14186
diff changeset
144 #ifdef WINDOWSNT
274b79aeb3b7 (memory_warnings) [WINDOWSNT]: Reset lim_data on each
Andrew Innes <andrewi@gnu.org>
parents: 14186
diff changeset
145 /* Force data limit to be recalculated on each run. */
274b79aeb3b7 (memory_warnings) [WINDOWSNT]: Reset lim_data on each
Andrew Innes <andrewi@gnu.org>
parents: 14186
diff changeset
146 lim_data = 0;
274b79aeb3b7 (memory_warnings) [WINDOWSNT]: Reset lim_data on each
Andrew Innes <andrewi@gnu.org>
parents: 14186
diff changeset
147 #endif
734
64e152d639af entered into RCS
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
148 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
149
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
150 /* arch-tag: eab04eda-1f69-447a-8d9f-95f0a3983ca5
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
151 (do not change this comment) */