aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 7f05cf77937..c4496b6ff7b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -766,6 +766,23 @@ lisp_align_malloc (nbytes, type)
766 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); 766 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
767#endif 767#endif
768 768
769 /* If the memory just allocated cannot be addressed thru a Lisp
770 object's pointer, and it needs to be, that's equivalent to
771 running out of memory. */
772 if (type != MEM_TYPE_NON_LISP)
773 {
774 Lisp_Object tem;
775 char *end = (char *) base + ABLOCKS_BYTES - 1;
776 XSETCONS (tem, end);
777 if ((char *) XCONS (tem) != end)
778 {
779 lisp_malloc_loser = base;
780 free (base);
781 UNBLOCK_INPUT;
782 memory_full ();
783 }
784 }
785
769 /* Initialize the blocks and put them on the free list. 786 /* Initialize the blocks and put them on the free list.
770 Is `base' was not properly aligned, we can't use the last block. */ 787 Is `base' was not properly aligned, we can't use the last block. */
771 for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++) 788 for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++)
@@ -788,21 +805,6 @@ lisp_align_malloc (nbytes, type)
788 val = free_ablock; 805 val = free_ablock;
789 free_ablock = free_ablock->x.next_free; 806 free_ablock = free_ablock->x.next_free;
790 807
791 /* If the memory just allocated cannot be addressed thru a Lisp
792 object's pointer, and it needs to be,
793 that's equivalent to running out of memory. */
794 if (val && type != MEM_TYPE_NON_LISP)
795 {
796 Lisp_Object tem;
797 XSETCONS (tem, (char *) val + nbytes - 1);
798 if ((char *) XCONS (tem) != (char *) val + nbytes - 1)
799 {
800 lisp_malloc_loser = val;
801 free (val);
802 val = 0;
803 }
804 }
805
806#if GC_MARK_STACK && !defined GC_MALLOC_CHECK 808#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
807 if (val && type != MEM_TYPE_NON_LISP) 809 if (val && type != MEM_TYPE_NON_LISP)
808 mem_insert (val, (char *) val + nbytes, type); 810 mem_insert (val, (char *) val + nbytes, type);