Malloc AIX 3.1 vs. AIX 3.2

Malloc AIX 3.1 vs. AIX 3.2

Post by bruce park » Sun, 20 Sep 1992 03:53:21



Could someone explain EXACTLY what changed internal
to the malloc system call between AIX 3.1 and AIX 3.2?
We are seeing some strange problems when porting some
of our software from 3.1 to 3.2.

Thanks for any help.

--

Bruce E. Parkin

Malathi Rao

 
 
 

Malloc AIX 3.1 vs. AIX 3.2

Post by Marc Ausland » Thu, 24 Sep 1992 04:12:03



>Newsgroups: comp.unix.aix
>Path: yktnews!admin!newsgate.watson.ibm.com!uunet!ncsys!bruce
>Organization: National Computer Systems, Inc.
>Followup-To: comp.unix.aix
>Lines: 14
>Could someone explain EXACTLY what changed internal
>to the malloc system call between AIX 3.1 and AIX 3.2?
>We are seeing some strange problems when porting some
>of our software from 3.1 to 3.2.
>Thanks for any help.
>--
>Bruce E. Parkin

>Malathi Rao


A different algorithm is used in 3.2.  The 3.1 algorithm rounded
requests' sizes to the next power of 2, and did a poor job of reusing
freed space.  The 3.2 algorithm rounds to the next 8 byte boundary,
and reuses freed space aggressively.

Because of these changes, several kinds of bugs are more likely to
cause trouble under 3.2.  These include:

assuming malloc'd storage is zero.  It is at first use, but not if
        the space is being reused - better reuse means fewer zeros.

overwriting the end of malloc'd space - with power of 2 rounding there
        is more room for error.

using the contents of malloc'd storage after it is freed.  Again, more
        reuse means the values change sooner.

In addition, the new algorithm detects more useage errors.  However,
this is relatively easy to debug.

--