diff options
| author | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
| commit | 3c4ca7155293ffc2d04708007131bcbc882d8913 (patch) | |
| tree | 61787be8cd43b6fb3d5159852fbd186eea404de7 /src/ralloc.c | |
| parent | 5ade42a5114255c43117065494b96d480c1e1588 (diff) | |
| parent | c708524567662c8911c5ab2695acc7bda0383705 (diff) | |
| download | emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.tar.gz emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.zip | |
Merge from trunk.
Diffstat (limited to 'src/ralloc.c')
| -rw-r--r-- | src/ralloc.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/ralloc.c b/src/ralloc.c index 11897411930..e5bf76b0e6d 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -327,6 +327,8 @@ relinquish (void) | |||
| 327 | 327 | ||
| 328 | if ((char *)last_heap->end - (char *)last_heap->bloc_start <= excess) | 328 | if ((char *)last_heap->end - (char *)last_heap->bloc_start <= excess) |
| 329 | { | 329 | { |
| 330 | heap_ptr lh_prev; | ||
| 331 | |||
| 330 | /* This heap should have no blocs in it. If it does, we | 332 | /* This heap should have no blocs in it. If it does, we |
| 331 | cannot return it to the system. */ | 333 | cannot return it to the system. */ |
| 332 | if (last_heap->first_bloc != NIL_BLOC | 334 | if (last_heap->first_bloc != NIL_BLOC |
| @@ -335,28 +337,26 @@ relinquish (void) | |||
| 335 | 337 | ||
| 336 | /* Return the last heap, with its header, to the system. */ | 338 | /* Return the last heap, with its header, to the system. */ |
| 337 | excess = (char *)last_heap->end - (char *)last_heap->start; | 339 | excess = (char *)last_heap->end - (char *)last_heap->start; |
| 338 | last_heap = last_heap->prev; | 340 | lh_prev = last_heap->prev; |
| 339 | last_heap->next = NIL_HEAP; | 341 | /* If the system doesn't want that much memory back, leave |
| 342 | last_heap unaltered to reflect that. This can occur if | ||
| 343 | break_value is still within the original data segment. */ | ||
| 344 | if ((*real_morecore) (- excess) != 0) | ||
| 345 | { | ||
| 346 | last_heap = lh_prev; | ||
| 347 | last_heap->next = NIL_HEAP; | ||
| 348 | } | ||
| 340 | } | 349 | } |
| 341 | else | 350 | else |
| 342 | { | 351 | { |
| 343 | excess = (char *) last_heap->end | 352 | excess = (char *) last_heap->end |
| 344 | - (char *) ROUNDUP ((char *)last_heap->end - excess); | 353 | - (char *) ROUNDUP ((char *)last_heap->end - excess); |
| 345 | last_heap->end = (char *) last_heap->end - excess; | 354 | /* If the system doesn't want that much memory back, leave |
| 346 | } | 355 | the end of the last heap unchanged to reflect that. This |
| 347 | 356 | can occur if break_value is still within the original | |
| 348 | if ((*real_morecore) (- excess) == 0) | 357 | data segment. */ |
| 349 | { | 358 | if ((*real_morecore) (- excess) != 0) |
| 350 | /* If the system didn't want that much memory back, adjust | 359 | last_heap->end = (char *) last_heap->end - excess; |
| 351 | the end of the last heap to reflect that. This can occur | ||
| 352 | if break_value is still within the original data segment. */ | ||
| 353 | last_heap->end = (char *) last_heap->end + excess; | ||
| 354 | /* Make sure that the result of the adjustment is accurate. | ||
| 355 | It should be, for the else clause above; the other case, | ||
| 356 | which returns the entire last heap to the system, seems | ||
| 357 | unlikely to trigger this mode of failure. */ | ||
| 358 | if (last_heap->end != (*real_morecore) (0)) | ||
| 359 | emacs_abort (); | ||
| 360 | } | 360 | } |
| 361 | } | 361 | } |
| 362 | } | 362 | } |