X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: new[] and delete[] Date: 13 Mar 2002 13:10:59 GMT Organization: Aachen University of Technology (RWTH) Lines: 29 Message-ID: References: <153702b153a9656b9b4eb20c28da0d7f DOT 76722 AT mygate DOT mailgate DOT org> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1016025059 6029 137.226.32.75 (13 Mar 2002 13:10:59 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 13 Mar 2002 13:10:59 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Giovanni Spagnuolo wrote: > MSG: Listing info about allocated blocks at end(?) of program: > INFO: 37 blocks currently allocated. > INFO: 163036428 bytes of memory currently used. > INFO: 163036428 bytes maximum memory used. 37 currently open allocs using 160 Megs, and over 20000 new[] and free[] calls up to this point.... to me this looks like you have a serious algorithmical problem. You'll want to redesign your memory allocation strategy all the way from the start. E.g. try to avoid short-term new[]-free[] pairs for temporary variables whenever possible. C++ operator overloads can cause lots of grief in this area --- using them to implement maths on large matrices may not be nearly as good an idea as it seems, at first glance. > As you can see, there are no memory bugs, but the maximum available > memory is about 163MB, while I have 256MB of RAM installed. That can happen, due to rounding of memory block sizes to the next power of two. I.e. you "use" more memory than you actually get. And then there's heap fragmentation that could also be a part of the problem. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.