1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 14:30:43 -08:00
Commit graph

54 commits

Author SHA1 Message Date
Dave Love
b1685c5fea (__malloc_extra_blocks): Declare as __malloc_size_t. 2000-09-25 21:07:55 +00:00
Gerd Moellmann
02bb17d31c Remove everything having to do with the use of mmap. 2000-09-14 15:14:28 +00:00
Gerd Moellmann
9824c4e39e (mmap_enlarge): Don't return 0 if successful. 2000-09-10 11:19:00 +00:00
Gerd Moellmann
d1a0288150 (mmap_fd): Remove initializer which can make it
read-only in a dumped Emacs.
(mmap_fd_1): New variable.
(mmap_set_vars): Remove local `fd'.  Save mmap_fd in mmap_fd_1,
restore it from there.
(r_alloc, r_re_alloc, r_alloc_free): Call r_alloc_init
unconditionally so that mmap_fd can be initialized there.
(r_alloc_init_fd): Open-coded in r_alloc_init; function removed.
(r_alloc_init) [REL_ALLOC_MMAP && !MAP_ANON]: Open /dev/zero.
(r_alloc_init) [REL_ALLOC_MMAP && MAP_ANON]: Set mmap_fd to -1.
2000-09-08 19:52:57 +00:00
Dave Love
d93c318653 (r_alloc_init_fd): Move. Fix conditional for pcc. 2000-09-08 16:31:11 +00:00
Dave Love
5ad25b24df (r_alloc_init): Conditionalize on SYSTEM_MALLOC, not REL_ALLOC_MMAP. 2000-09-08 16:03:04 +00:00
Dave Love
423193c552 (r_alloc_init_fd): Conditionalize on MAP_ANON. 2000-09-08 14:10:31 +00:00
Dave Love
a2c23c923a Don't include string.h (redundant).
(MAP_ANON) [REL_ALLOC_MMAP]: Ensure it's defined.
[!MAP_ANON]: Include fcntl.h.
(mmap_fd) [REL_ALLOC_MMAP]: New variable.
(r_alloc, r_re_alloc, r_alloc_free)
(mmap_enlarge, mmap_set_vars): Use it.
(r_alloc_init_fd): New function.
(__morecore) [SYSTEM_MALLOC]: Don't declare.
(r_alloc_init): Call r_alloc_init_fd.  Conditionalize stuff on
malloc type.
2000-09-08 13:46:27 +00:00
Gerd Moellmann
91a211b50d (obtain, relinquish, relinquish, r_alloc_size_in_use)
(get_bloc, relocate_blocs, update_heap_bloc_correspondence)
(resize_bloc, r_alloc_sbrk, r_alloc_init): Add casts to `char *'
where necessary, in case POINTER_TYPE is `void'.
2000-09-07 19:24:42 +00:00
Gerd Moellmann
24f76fbf71 (mmap_find): Fix overlap computation.
(mmap_enlarge): Compute nbytes before trying to find an
overlapping region.
2000-09-07 16:10:38 +00:00
Gerd Moellmann
0a58f94648 (POINTER, SIZE) [emacs]: Define in terms of
POINTER_TYPE and size_t.
(struct mmap_region) [REL_ALLOC_MMAP]: New structure.
(mmap_regions, mmap_regions_1) [REL_ALLOC_MMAP]: New variables.
(ROUND, MMAP_REGION_STRUCT_SIZE, MMAP_REGION, MMAP_USER_AREA)
[REL_ALLOC_MMAP]: New macros.
(mmap_find, mmap_free, mmap_enlarge, mmap_set_vars)
(mmap_mapped_bytes, r_alloc, r_re_alloc, r_alloc_free)
[REL_ALLOC_MMAP]: New functions.
2000-09-06 21:25:49 +00:00
Andrew Innes
321ed47b16 Make real_morecore non-static. 2000-07-05 16:31:17 +00:00
Dave Love
642a173373 Maybe include unistd.h. 2000-06-23 17:33:37 +00:00
Karl Heuer
2153266750 (relinquish): When returning memory to the system,
watch out for the original data segment boundary.
1997-09-27 16:01:00 +00:00
Richard M. Stallman
dec414188f (r_alloc_reinit): New function. 1997-07-12 07:04:43 +00:00
Richard M. Stallman
b0119c6825 (mallopt): Declare, if appropriate.
(r_alloc_init) [DOUG_LEA_MALLOC]: Call mallopt,
instead of setting __malloc_extra_blocks.
1997-05-16 05:35:04 +00:00
Richard M. Stallman
40f3f04b97 (r_alloc_check): Don't check alignment of h->start. 1996-04-07 16:44:38 +00:00
Erik Naggum
3b7ad313e0 Update FSF's address in the preamble. 1996-01-15 09:18:04 +00:00
Karl Heuer
8e6208c5d2 Comment fixes. 1996-01-05 10:03:17 +00:00
Richard M. Stallman
49f82b3d1a (r_re_alloc): Correct realloc behavior--allow shrinking
of blocks while reallocating, if shrinking by more than one page.
(relocate_blocs, resize_blocs): Added failsafe to protect future
calling of these routines when in frozen state.
(r_alloc_thaw): Added call to r_alloc_init.
(relocate_blocks, resize_bloc, r_alloc_sbrk, r_alloc_thaw): Extended
functionality to let ralloc package work in frozen state, allowing
for the existence of unused blocks.
1995-03-28 17:43:24 +00:00
Richard M. Stallman
4908183440 (r_alloc_init): Set __malloc_extra_blocks. 1995-02-19 19:12:17 +00:00
Richard M. Stallman
44d3dec071 (r_alloc_check): Return void.
(r_alloc_freeze): Initialize if it hasn't been done.
(r_re_alloc, r_alloc_free, r_alloc_sbrk): Likewise.
1995-02-16 06:45:36 +00:00
Richard M. Stallman
6d16dd06fb Whitespace fixes. 1995-02-16 06:36:19 +00:00
Richard M. Stallman
d5179accb2 (r_alloc_free): Call refill_memory_reserve only if emacs.
Include getpagesize.h unconditionally.
(free_bloc): Don't die if bloc->next or bloc->prev is null.
[!emacs] (bzero): New macro definition.
1995-02-14 14:27:18 +00:00
Richard M. Stallman
719b242f86 (r_alloc_size_in_use): New function.
(r_alloc_free): Call refill_memory_reserve.
1995-02-07 22:43:23 +00:00
Roland McGrath
187996a8fd (r_alloc_init): Remove unused variable END. 1995-01-15 13:04:55 +00:00
Richard M. Stallman
47f13333c0 (struct heap): New fields first_bloc, last_bloc.
(struct bp): New field heap.
(get_bloc, free_bloc, obtain, r_alloc_sbrk): Update new fields.
(reorder_bloc): New function.
(update_heap_bloc_correspondence):
Renamed from update_heap_free_pointers.  Update new fields.
(relinquish): Add error check for new fields.
1994-10-23 06:16:43 +00:00
Richard M. Stallman
abe9ff327f (heap_base): Move static var to top level.
(struct heap): New slot `free'.
(obtain): Set `free' for new heap.
(get_bloc): Update `free'.
(find_heap): New function.
(update_heap_free_pointers): New function.
(resize_bloc, r_alloc_sbrk): Call update_heap_free_pointers.
1994-10-18 21:53:19 +00:00
Karl Heuer
e429caa215 Install Hiroshi Nakano's rewrite to allow multiple heaps, for implementations
where the C library makes calls to sbrk directly.
1994-10-12 00:48:03 +00:00
Karl Heuer
81bd58e880 (r_alloc_freeze_level): New variable.
(r_alloc_freeze, r_alloc_thaw): New functions.
(r_alloc_sbrk): Refuse to move blocs, if frozen.
1994-09-20 05:51:50 +00:00
Richard M. Stallman
0e93a7cf3f (r_alloc_init): Explicitly use real_morecore
to allocate the entire incomplete page.
1993-11-18 09:26:05 +00:00
Roland McGrath
18160b98ce Include <config.h> instead of "config.h". 1993-09-10 06:15:46 +00:00
Roland McGrath
f7a009a5c4 (ALIGNED, ROUNDUP): Use unsigned long int' instead of unsigned int' for
casting addresses and sizes.  It matters on the 64-bit Alpha.
1993-07-22 18:59:43 +00:00
Jim Blandy
eb8c3be94e Apply typo patches from Paul Eggert. 1993-06-09 11:59:12 +00:00
Richard M. Stallman
89ccd65a24 (r_alloc_sbrk): Declare already_available as long, not SIZE. 1993-05-26 20:38:52 +00:00
Richard M. Stallman
a8c0e5ea6b (POINTER): Always use char *. 1993-05-26 03:49:40 +00:00
Jim Blandy
c6c5df7f76 Updated copyright years. 1993-05-22 21:34:42 +00:00
Roland McGrath
1df181b65f [! emacs] [HAVE_CONFIG_H]: #include "config.h" 1992-12-29 21:58:10 +00:00
Jim Blandy
ad3bb3d260 * ralloc.c (relocate_some_blocs): Handle BLOC == NIL_BLOC.
(free_bloc): This can now be simplified.

	* ralloc.c (r_alloc_sbrk): When we allocate new space for the
	malloc heap, zero it out even if we don't have any blocs in the
	free list.
1992-11-16 00:54:08 +00:00
Richard M. Stallman
7516b7d521 (relinquish): Adjust page_break_value by amount of memory actually given back.
(r_alloc_sbrk): Provide hysteresis in relocating the blocs.

(relinquish): Never free less than extra_bytes;
keep extra_bytes of empty space.
(obtain): Always get extra_bytes additional space.
(r_alloc_init): Set extra_bytes and page_size.
(ALIGNED, ROUNDUP, ROUND_TO_PAGE): Use page_size.
1992-10-24 04:39:49 +00:00
Richard M. Stallman
f275fd9a94 [emacs]: Define POINTER and SIZE.
[!emacs]: Delete definition of EXCEEDS_LISP_PTR.
1992-10-20 06:12:43 +00:00
Roland McGrath
aef4d57054 Removed #include "mem-limits.h".
[emacs]: Moved #undef NULL and #include "getpagesize.h" here.
[! emacs]: #include <unistd.h>, <malloc.h>, <string.h>.
(r_alloc_init): Use NIL, not NULL.
1992-10-12 21:40:50 +00:00
Roland McGrath
bbc60227be (sbrk): Removed decl.
(real_morecore): New static variable.
(warnlevel, warn_function, check_memory_limits): Removed.
(obtain): Don't call check_memory_limits.
(obtain, relinquish, r_alloc_sbrk): Use (*real_morecore) in place of sbrk;
it returns 0 for errors, not -1.
(r_alloc_init): Set real_morecore to old value of __morecore.
Don't initialize lim_data or warnlevel, and don't call get_lim_data.
(memory_warnings): Function removed.
1992-10-12 21:07:25 +00:00
Roland McGrath
e231fd422e mem_limits.h is now called mem-limits.h. 1992-10-12 18:55:05 +00:00
Richard M. Stallman
2c46d29fbd (check_memory_limits): Reduce warnlevel when usage drops far enough.
(memory_warnings): New function; just set warning data.
Use start_of_data if start is 0.

[!emacs]: Don't include config.h or lisp.h;
instead, use stddef.h.  Define POINTER, SIZE, EXCEEDS_LISP_PTR.

[!emacs] (safe_bcopy): Define as macro using memmove.
(r_alloc_free): Clear *ptr.
(r_alloc_init): Renamed from malloc_init.  Take no args.
Make it static; declare at top of file.
(r_alloc): Call r_alloc_init, if not initialized yet.
(r_alloc_initialized): Renamed from malloc_initialized; moved to top.
(ROUNDUP): Subtract 1, in case arg is already aligned.

(check_memory_limits): EXCEEDS_LISP_PTR renamed from EXCEEDS_ELISP_PTR.
1992-10-11 20:37:32 +00:00
Jim Blandy
98b7fe026f * ralloc.c: Since the users of the relocating allocation code
handle memory exhaustion, it's better to return an error code to
	them than to call abort.
	(obtain): If we cannot allocate more memory, don't call
	abort.  Instead, return non-zero iff the allocation is successful.
	(get_more_space): If obtain fails, return zero.
	(get_bloc): Return zero if we can't allocate the new bloc.
	(r_alloc_sbrk): Return zero if we can't allocate more memory.
	(r_alloc): If we can't allocate more memory, set *PTR to zero and
	return zero.
	(r_re_alloc): If we can't allocate more memory, leave *PTR
	unchanged, and return zero.

	* ralloc.c (warnfunction): Renamed to warn_function; users changed.
1992-09-29 01:08:33 +00:00
Jim Blandy
0abf54e322 Fix typo. 1992-09-13 12:35:06 +00:00
Jim Blandy
16a5c72935 * ralloc.c (r_re_alloc): Instead of allocating a new bloc at the
end of the heap, copying the data to it, and then freeing the
	original bloc, just expand the original block.  This saves a copy
	and a call to sbrk, and also removes the large spike in memory
	allocation that would occur when resizing large buffers.  And it's
	less code.
1992-09-09 00:05:42 +00:00
Jim Blandy
8c7f1e3596 * ralloc.c (get_bloc): When initializing new_bloc->variable, cast
NIL to (POINTER *).
	(malloc_init): Give warning if sbrk returns zero.  Wonder what
	that's supposed to mean.
1992-08-19 06:36:35 +00:00
Joseph Arceneaux
94d7c01aae entered into RCS 1992-06-30 22:41:21 +00:00