From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,4d22f69d43e551b6 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1992-03-08 23:29:27 PST Newsgroups: comp.sys.dec Path: sparky!uunet!think.com!mips!mips!decwrl!pa.dec.com!decuac!hussar.dco.dec.com!mjr From: mjr@hussar.dco.dec.com (Marcus J. OpenRanum) Subject: Re: lmalloc advantages Message-ID: <1992Mar9.021225.8063@decuac.dec.com> Sender: news@decuac.dec.com (USENET News System) Nntp-Posting-Host: hussar.dco.dec.com Organization: Digital Equipment Corporation, Washington ULTRIX Resource Center References: <1616@pvi.UUCP> Distribution: usa Date: Mon, 9 Mar 1992 02:12:25 GMT ncar!pvi!james() writes: >By including -lmalloc they say the process can malloc more >memory. Any advice on the advantages of including -lmalloc >would be greatly appreciated. I don't know anything about allocating more or less memory with different versions of malloc() - however: -lmalloc uses a binary lazy buddy allocation scheme - it's very quick for allocating small objects, but uses more memory as it works. -lmalloc has a variety of ways that you can pass "hints" to the allocator to tell it what size objects to optimize for. these hints aren't supported with the default malloc(), so you're writing nonportable code if you use these. I personally prefer using something like my own memory allocation profiler to see what the hell's going on - it's malloc-independent. -since the -lmalloc malloc() uses more space to allocate the same amount of objects, I'd expect you'd actually be able to allocate more memory with the default malloc(). -in some circumstances (that I have measured - a C++ program that allocates manymanymany things) the -lmalloc is 3-6X faster than the default one. -on the other hand, the in-core image was almost 2Mb larger. Depending on what your application does, its allocation patterns, how often stuff is allocated/freed, sizes of objects, etc, etc (all crucial information you do not provide) it's hard to give a meaningful answer, just these observations. Why do you care? Have you profiled your application and noticed it is spending a lot of time in malloc()? Or is it using too much core? What problem are you trying to solve? mjr. -- Theoretical computer scientist: about as useful as a theoretical ditch-digger, but more widely published. - notebooks of a heretic.