Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark From: ark@alice.UucP (Andrew Koenig) Newsgroups: net.unix Subject: Re: get size of malloc'd object Message-ID: <5704@alice.uUCp> Date: Wed, 25-Jun-86 09:17:08 EDT Article-I.D.: alice.5704 Posted: Wed Jun 25 09:17:08 1986 Date-Received: Fri, 27-Jun-86 06:56:14 EDT References: <139@uwslh.UUCP> Organization: Bell Labs, Murray Hill Lines: 16 > One nasty efficiency quirk probably ought to be mentioned. The schemes which > add extra user information to remember the size of the object are okay, > modulo some pointer alignment details. Care with the size of the objects > may be needed if you are allocating lots of them, though. Some memory > allocators allocate things in fixed sizes, such as power-of-two minus some > internal overhead. If a program is allocating funny sized buffers scaled to > cooperate with brain damaged allocators, and then adds extra overhead, the > resulting size may cause poor allocators to waste lots of space. Of course, > 'knowing' the size of blocks actually allocated is not portable. But if you > are tight on address space or physical memory, it could matter. Translated into English, this says: Some memory allocators are broken. Thus we should all warp our programs into forms that work well with these broken memory allocators.