Bug 112907

Summary: free() doesn't release the memory via sbrk() if the core is larger than approx 1GB
Product: [Retired] Red Hat Linux Reporter: Krzysio (Chris) Leszczynski <chris>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED CANTFIX QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: medium    
Version: 9CC: fweimer, mattdm
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-01-02 19:15:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
A program mentioned in the bug report. none

Description Krzysio (Chris) Leszczynski 2004-01-05 19:50:38 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031030

Description of problem:
free() normally decreases the program core via sbr(-negative_value) if
it finds its possible.  Somehow it fails to do it when the program
core exceeds 0.9GB.  I wrote a small program testmalloc.c that malloc()
and free() a specified number of kilobytes.

I run it on machine with 1GB RAM and 512MB swap.

Version-Release number of selected component (if applicable):
glibc-2.3.2-27.9.7, gcc-3.2.2-5

How reproducible:
Always

Steps to Reproduce:
1. gcc -Wall -pedantic -o testmalloc testmalloc.c
2. You must have a machine with 1GB of free memory, if you don't
   have as much RAM, create some swap. 
3. ./testmem  900000
4. ./testmem 1000000

Actual Results:  The first program (testmem 900000) produces the output:
$ ./testmalloc 900000
All chunks have been allocated, current core=921969948 bytes
All chunks have been free()d,   current core=1308 bytes

The second one:
$ ./testmalloc 1000000
All chunks have been allocated, current core=940897564 bytes
All chunks have been free()d,   current core=940897564 bytes

Note that in the second case the core was not released.

Expected Results:  I would expect that program releases its core.

Additional info:

I don't think it's a bug in Red Hat, it looks like a bug in glibc.
I have tested this behaviour on PLD Linux. Both Red Hat and PLD
demonstrate the same problem. Many thanks to Sebastian Zagrodzki
from PLD team for testing it on his PLD machine.

Comment 1 Krzysio (Chris) Leszczynski 2004-01-05 19:52:38 UTC
Created attachment 96772 [details]
A program mentioned in the bug report.

Comment 2 Bill Nottingham 2006-08-05 05:19:32 UTC
Red Hat apologizes that these issues have not been resolved yet. We do want to
make sure that no important bugs slip through the cracks.

Red Hat Linux 7.3 and Red Hat Linux 9 are no longer supported by Red Hat, Inc.
They are maintained by the Fedora Legacy project (http://www.fedoralegacy.org/)
for security updates only. If this is a security issue, please reassign to the
'Fedora Legacy' product in bugzilla. Please note that Legacy security update
support for these products will stop on December 31st, 2006.

If this is not a security issue, please check if this issue is still present
in a current Fedora Core release. If so, please change the product and version
to match, and check the box indicating that the requested information has been
provided.

If you are currently still running Red Hat Linux 7.3 or 9, please note that
Fedora Legacy security update support for these products will stop on December
31st, 2006. You are strongly advised to upgrade to a current Fedora Core release
or Red Hat Enterprise Linux or comparable. Some information on which option may
be right for you is available at http://www.redhat.com/rhel/migrate/redhatlinux/.

Any bug still open against Red Hat Linux 7.3 or 9 at the end of 2006 will be
closed 'CANTFIX'. Again, if this bug still exists in a current release, or is a
security issue, please change the product as necessary. We thank you for your
help, and apologize again that we haven't handled these issues to this point.


Comment 4 Bill Nottingham 2007-01-02 19:15:43 UTC
Red Hat Linux 7.3 and Red Hat Linux 9 are no longer supported by Red Hat, Inc.
f you are currently still running Red Hat Linux 7.3 or 9, you are strongly
advised to upgrade to a current Fedora Core release or Red Hat Enterprise Linux
or comparable. Some information on which option may be right for you is
available at http://www.redhat.com/rhel/migrate/redhatlinux/.

Closing as CANTFIX.