[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Mint Bug?



Hey guys,

This one is VERY INTERESTING!  I'm confused with this one.  Binutils
2.16.1 gets an error linking part of gcc.  This error is not present
with binutils 2.13.  Anyway, I traced it down to a failure of malloc()
itself sometime around after binutils allocates 10megabytes.

So I ran a test.  It allocates 1 megabyte every 1 second, tells you if
the pointer is null or not, and then runs "free".  If the pointer is
null it means malloc failed, incidentally I ran free just to ensure it
wasn't magically a null pointer and the memory was actually allocated.

Here is the output:

root@washi:/root/binutils/binutils-mint/ld>./malloctest
Malloc 1, allocating 1 megabyte
261472256 bytes (255344K) free.
Malloc 2, allocating 1 megabyte
260440064 bytes (254336K) free.
Malloc 3, allocating 1 megabyte
259407872 bytes (253328K) free.
Malloc 4, allocating 1 megabyte
258375680 bytes (252320K) free.
Malloc 5, allocating 1 megabyte
257343488 bytes (251312K) free.
Malloc 6, allocating 1 megabyte
256311296 bytes (250304K) free.
Malloc 7, allocating 1 megabyte
255279104 bytes (249296K) free.
Malloc 8, allocating 1 megabyte
254246912 bytes (248288K) free.
Malloc 9, allocating 1 megabyte
253214720 bytes (247280K) free.
Malloc 10, allocating 1 megabyte
252182528 bytes (246272K) free.
Malloc 11, allocating 1 megabyte
251150336 bytes (245264K) free.
Malloc 12, allocating 1 megabyte
250118144 bytes (244256K) free.
Malloc 13, allocating 1 megabyte
ERROR!: pointer is NULL on count: 13
250118144 bytes (244256K) free.
Malloc 14, allocating 1 megabyte
ERROR!: pointer is NULL on count: 14
250118144 bytes (244256K) free.

You can see at count 13 malloc fails.. it will continue to fail.  To see
if this is a per-process limit, I logged in again via ssh and ran the
test again while the other one was frozen with it's allocated ram.
Every pointer returned was null.

I don't know much about how malloc works, but this test succeeds on all
of my linux boxes to an extremely high count.

For giggles, I tried on aranym too - It SUCCEEDS.  Right up until aranym
runs out of ram completely.  I have to try on a TT as well, but I don't
have that setup right now.

So this is either a CT60 hardware problem since the same failure occurs
on a completely different CT60 falcon, a MiNT/Falcon/CT60 code bug
(something that aranym wouldn't be using), or I'm just nuts.

I spent an awful lot of time bughunting in binutils for incorrect sizes
when it turns out malloc wasn't even succeeding!

Thanks,
Mark