Re: memory fragmentation
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Sat, 20 Dec 2008 08:31:59 -0600
"Barry Schwarz" <schwarzb@xxxxxxxx> wrote in message news:2efpk49gmji4r2viotkp3g2bq3ai6frcuu@xxxxxxxxxx
On Fri, 19 Dec 2008 23:20:01 -0800, NianHawk
<NianHawk@xxxxxxxxxxxxxxxxxxx> wrote:
would frequent allocation and release of small buffers definitely cause
memory leaks? My application have to allocate small buffer for sending data
and then release it after it is done very frequently. I am not sure whether
it would cause memory fragmentation and thus poor performance? Your help
would be appreciated.
Why or how do you think memory fragmentation would cause poor
performance?
Because there are more blocks for the heap manager to keep track of? I doubt the heap algorithms are O(N), but I also doubt they are O(1).
In addition, heap allocation and deallocation are fairly slow operations which additionally require obtaining a global lock. So it's best to reuse buffers internally instead of freeing and reallocating, if possible.
--
Remove del for email
.
- Follow-Ups:
- Re: memory fragmentation
- From: Barry Schwarz
- Re: memory fragmentation
- References:
- memory fragmentation
- From: NianHawk
- Re: memory fragmentation
- From: Barry Schwarz
- memory fragmentation
- Prev by Date: Re: memory fragmentation
- Next by Date: Re: Running in virtual machine?
- Previous by thread: Re: memory fragmentation
- Next by thread: Re: memory fragmentation
- Index(es):
Relevant Pages
|