766 |
mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); |
mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); |
767 |
#endif |
#endif |
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 |
|
|
786 |
/* Initialize the blocks and put them on the free list. |
/* Initialize the blocks and put them on the free list. |
787 |
Is `base' was not properly aligned, we can't use the last block. */ |
Is `base' was not properly aligned, we can't use the last block. */ |
788 |
for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++) |
for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++) |
805 |
val = free_ablock; |
val = free_ablock; |
806 |
free_ablock = free_ablock->x.next_free; |
free_ablock = free_ablock->x.next_free; |
807 |
|
|
|
/* If the memory just allocated cannot be addressed thru a Lisp |
|
|
object's pointer, and it needs to be, |
|
|
that's equivalent to running out of memory. */ |
|
|
if (val && type != MEM_TYPE_NON_LISP) |
|
|
{ |
|
|
Lisp_Object tem; |
|
|
XSETCONS (tem, (char *) val + nbytes - 1); |
|
|
if ((char *) XCONS (tem) != (char *) val + nbytes - 1) |
|
|
{ |
|
|
lisp_malloc_loser = val; |
|
|
free (val); |
|
|
val = 0; |
|
|
} |
|
|
} |
|
|
|
|
808 |
#if GC_MARK_STACK && !defined GC_MALLOC_CHECK |
#if GC_MARK_STACK && !defined GC_MALLOC_CHECK |
809 |
if (val && type != MEM_TYPE_NON_LISP) |
if (val && type != MEM_TYPE_NON_LISP) |
810 |
mem_insert (val, (char *) val + nbytes, type); |
mem_insert (val, (char *) val + nbytes, type); |