Boost logo

Boost Users :

From: David Barrett-Lennard (dbl_at_[hidden])
Date: 2004-04-13 01:52:31


Hi Victor,

The CRT library that comes with VC is only a thin wrapper for the heap
allocator implemented in kernel.dll - see HeapAlloc() in MSDN. For
that reason it won't make any difference what version of VC is used.

Note that I haven't seen the pathological behavior with Windows 98.

Does anyone know how to enable the LFH (low fragmentation heap) for the
heap created by the VC CRT?

- David

> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Victor A. Wagner Jr.
> Sent: Saturday, 10 April 2004 4:16 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] Changing the heap allocator
>
> re: (because of msvcp60.dll)
> that may sum up the entire problem.... VC++6.0 is
broken...period...simple
> statement of fact
> it was replaced 2 years ago by .net then again by .net2003
> you may wish to test with a current version
>
> At Wednesday 2004-04-07 19:54, you wrote:
> >Hi,
> >
> >I'm working on a project where I've replaced Microsoft's (terrible)
heap
> >allocator with the Doug Lea allocator. There seems to be some cases
> where
> >the Windows XP allocator is 500 times slower than it should be. This
> made
> >my program take minutes rather than seconds to run. To try to
understand
> >what kind of allocation patterns cause the behaviour I wrote a small
> >console application (see below). After playing around with different
> >allocation patterns for half an hour I found a case where the
> pathological
> >behaviour appeared. I'm none the wiser about the problem. For
example,
> >moving the malloc(301) statement before the 7 x malloc(1000) makes
the
> >problem go away! However, given the ease with which I rediscovered
the
> >problem, I wonder why there aren't more complaints about Microsoft's
heap
> >allocator. With some allocation patterns I have seen the allocator
fall
> >below 1kHz on a Pentium IV 2GHz machine!
> >
> >I've created a library that exports alternative versions of operator
new
> >and operator delete, by using a def file as follows
> >
> >EXPORTS
> > ??2_at_YAPAXI@Z
> > ??3_at_YAXPAX@Z
> >
> >I've had to do some hacky things to make it work with the STL
(because of
> >msvcp60.dll) , but that's another story!
> >
> >Now my question : I want to use boost, but need to work out how to
make
> it
> >use a different allocator. Will I need to rebuild the boost dlls
(such
> as
> >boost_python.dll), against my static library?
> >
> >
> >Regards,
> >David Barrett-Lennard
> >
> >
> >/////////////////////// heap allocation test
///////////////////////////
> >
> >#include <iostream>
> >#include <time.h>
> >
> >int main(int argc, char* argv[])
> >{
> > for (int count=1 ; count <= 5 ; ++count)
> > {
> > int n1 = 0, n2 = 0;
> > clock_t start = clock();
> > {
> > const int NUM = 10000;
> > void* L[NUM*7];
> > for (int i=0 ; i < NUM ; ++i)
> > {
> > for (int j=0 ; j < 7 ; ++j) L[n1++] = malloc(1000);
> > void* leak = malloc(301);
> > ++n2;
> > }
> > for (int k=n1-1 ; k >= 0 ; --k) free(L[k]);
> > }
> > clock_t elapsed = clock()-start;
> > if (elapsed)
> > {
> > std::cout << "Time = " << elapsed << " ms"
> > << " Rate = " << 1000 * (n1 + n2) / elapsed
<< "
> Hz"
> > << std::endl;
> > }
> > }
> > return 0;
> >}
> >
> >
> >
> >
> >
> >_______________________________________________
> >Boost-users mailing list
> >Boost-users_at_[hidden]
> >http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> Victor A. Wagner Jr. http://rudbek.com
> The five most dangerous words in the English language:
> "There oughta be a law"
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net