bug-glibc
[Top][All Lists]
Advanced

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

Re: mallinfo can't handle >2g values


From: Wolfram Gloger
Subject: Re: mallinfo can't handle >2g values
Date: Wed, 12 Mar 2003 12:05:37 +0100 ("MET)

Hi,

> The glibc mallinfo has a problem in that it uses int values as fields to
> return the amount of memory used.  This seems like a bug because
> allocations can go over 2G on linux.  On solaris mallinfo uses unsigned
> long for the fields.

That surprises me, as the only standard describing the mallinfo()
interface (the SVID/XPG manual) used int fields AFAIR.  E.g. the SCO
manual page for mallinfo also has int fields.

mallinfo is not in the Single Unix spec, however.

> Attached is a test program that demonstrates the problem.  If we use the
> procfs data we see more memory in use than mallinfo reports.  Please let
> me know if you agree.

We definitely cannot change the fields to unsigned long as that would
be a binary incompatible change on some architectures.

However, we could do unsigned arithmetic internally and hand out
"negative" ints in struct mallinfo that would "correctly" cast back to
unsigned, up to 4GB-1.  Would that be enough for you?

Regards,
Wolfram.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]