🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4566

Re: Alignment of malloc()

#4566
From: Stephen Baynes
Date: Fri, 05 Jan 1996 08:43
30 lines
2139 bytes
Michael Spertus (mps@geodesic.com) wrote:
: In article <4ccbdb$5v6@fg70.rz.uni-karlsruhe.de>,
: Thomas Koenig <ig25@mvmap66.ciw.uni-karlsruhe.de> wrote:
: >
: >I know of no compiler which is as brain-damaged as the one you describe;
: >when I encounter one, I'd tend to howl to the vendor.
: >-- 
: Many PC compilers have this problem (See the BYTEmark column in the
: December BYTE). The problem is that Win32 GlobalAlloc(), which is
: what most allocators use to get their arenas, returns a 32-bit aligned
: pointer. Most standard library implementations will pass through this
: alignment (probably because the implementor does not realize that
: GlobalAlloc() does not align very well so that code for an sbrk()
: based allocator cannot be used without change. They may also be unaware
: that Pentium PCs use 64 bits data buses). This problem is magnified
: because the Pentium (apparently) drops into microcode on nonaligned
: loads, so that nonaligned floating point benchmarks are over 300%
: slower.

This reminds me of a discussion over could calloc use the size parameter
as a hint to give different alignment to malloc. For example:
    calloc( N, sizeof( float ) )
could recognize the sizeof float and give 64 bit alignment in this case.
I recall the conclusion was that it could do this, but did not have to.
   
--
Stephen Baynes                              baynes@mulsoc2.serigate.philips.nl
Philips Semiconductors Ltd
Southampton                                 My views are my own.
United Kingdom
Technical Details
Message-ID: <DKp9L9.234@ukpsshp1.serigate.philips.nl>
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
References: <DKDA7D.Kw7@midway.uchicago.edu> <j66Sx*FRe@yaps.rhein.de> <DKKHCH.L6r@midway.uchicago.edu> <4ccbdb$5v6@fg70.rz.uni-karlsruhe.de> <DKo8ns.8A9@midway.uchicago.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
Subject: Re: Alignment of malloc()
Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
Message-ID: <DKp9L9.234@ukpsshp1.serigate.philips.nl>
Date: Fri, 5 Jan 1996 08:43:57 GMT
References: <DKDA7D.Kw7@midway.uchicago.edu> <j66Sx*FRe@yaps.rhein.de> <DKKHCH.L6r@midway.uchicago.edu> <4ccbdb$5v6@fg70.rz.uni-karlsruhe.de> <DKo8ns.8A9@midway.uchicago.edu>
Organization: Philips Semiconductors, Southampton, UK
X-Newsreader: TIN [version 1.2 PL2]