"Out of memory" in decompress stage (2.2.5)

Matthias Hanisch (matze@camline.com)
Wed, 31 Mar 1999 09:19:59 +0200 (METDST)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---559023410-218438523-922864799=:3066
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hallo!

At first: Yes, I'm using bzImage.

The "out of memory" condition happens in the malloc() code in
arch/i386/boot/compressed/misc.c which means that the HEAP_SIZE
for the decompressing structures is too small.

Some debugging outputs of the pointer show the following behavior:

free_mem_ptr at size to allocated free_mem_end_ptr
start of malloc
----------------------------------------------------------------
.
<some allocations and releases back to 0x86a0>
.
0xa170 0x18 0xa6a0
0xa188 0x18
.
.
.
0xa200 0x18
0xa218 0x28
.
.
.
0xa330 0x28
0xa358 0x108
0xa460 0x208 0xa6a0
0xa668 0x88 <- out of memory

The strange thing is that it seems to heavily depend on the gzipped
kernel image itself if an out of memory happens. During the addition
of the debugging output in misc.c it sometimes works and sometimes
not. This happened to me with various recent kernel versions, too.

The malloc(0x88) seems to be the last allocation before the release of the
malloc buffers again as if I interpret the other allocation patterns
before, so the heap is probably only about 100 bytes too low.

Could somebody with knowledge in inflate.c confirm that the heap buffer
size of 8192 bytes is insufficient and raise this limit to a safe value?
Does it harm if it is set to - say - 0x2400 bytes?

Thanks in advance,
Matze

P.S.: I've attached the diff of misc.c that I'm using for debugging. A
workaround without raising the heap limit is included, too (always
remember the last allocated pointer and release this memory if free
is called with this pointer - this frees the first allocation and
saves 520 - 1032 bytes).

-- 
Matthias Hanisch   office: matze@camline.com   private: matze@pingu.franken.de
                           +49 8137 935-219             +49 8441 82387

"CAPS - Software from Experts for Experts"

---559023410-218438523-922864799=:3066 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=diff Content-Transfer-Encoding: BASE64 Content-ID: <Pine.SC5.4.10.9903310919590.3066@cam8.camline.com> Content-Description: Content-Disposition: attachment; filename=diff

LS0tIGxpbnV4L2FyY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SwgdmlkcG9ydCsxKTsNCit9DQorDQorI2RlZmluZSBUT19IRVgobmliYmxl KSAoKChuaWJibGUpIDwgMTApID8gKCAnMCcgKyAobmliYmxlKSApIDogKCAn QScgKyAobmliYmxlKSAtIDEwICkpDQorIA0KK3N0YXRpYyB2b2lkIHB1dF9h ZGRyKGNvbnN0IGNoYXIgKnRleHQsIGxvbmcgcCkNCit7DQorCWNoYXIgY1s1 XTsNCisNCisJY1swXSA9IFRPX0hFWCgocCA+PiAxMikgJSAxNik7DQorCWNb MV0gPSBUT19IRVgoKHAgPj4gOCkgJSAxNik7DQorCWNbMl0gPSBUT19IRVgo KHAgPj4gNCkgJSAxNik7DQorCWNbM10gPSBUT19IRVgocCAlIDE2KTsNCisJ Y1s0XSA9ICdcMCc7DQorDQorCXB1dHModGV4dCk7DQorCXB1dHMoYyk7DQor CWZvciAoO3A7IHAtLSk7DQogfQ0KIA0KIHZvaWQqIG1lbXNldCh2b2lkKiBz LCBpbnQgYywgc2l6ZV90IG4pDQo= ---559023410-218438523-922864799=:3066--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/