 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vladimir Grigoriev Guest
|
Posted: Tue Apr 17, 2007 6:28 pm Post subject: About overloading new operator |
|
|
Do anybody have any good references for articles about overloading new
operator that based on user defined memory organizations.
Vladimir Grigoriev |
|
| Back to top |
|
 |
Thomas Maeder [TeamB] Guest
|
Posted: Tue Apr 17, 2007 9:11 pm Post subject: Re: About overloading new operator |
|
|
"Vladimir Grigoriev" <vlad.moscow (AT) mail (DOT) ru> writes:
| Quote: | Do anybody have any good references for articles about overloading
new operator that based on user defined memory organizations.
|
I assume that you are aware that you have two ways of introducing user
defined memory organization:
- by providing your own global (de)allocation functions
- by overloading the (de)allocation functions in classes or
class templates |
|
| Back to top |
|
 |
Hendrik Schober Guest
|
Posted: Wed Apr 18, 2007 1:43 am Post subject: Re: About overloading new operator |
|
|
Vladimir Grigoriev <vlad.moscow (AT) mail (DOT) ru> wrote:
| Quote: | Do anybody have any good references for articles about overloading new
operator that based on user defined memory organizations.
|
I forgot about earlier editions, but in its 3rd,
Scott Meyers "Effective C++" has a whole chapter
about 'new' and 'delete' including at least one
item about overloading them. While I think bying
the book just for this might be a bit overkill,
it's a book every C++ programmer should have read
anyway, so you wouldn't only buy it for this. :)
| Quote: | Vladimir Grigoriev
|
Schobi
--
SpamTrap (AT) gmx (DOT) de is never read
I'm HSchober at gmx dot org
"My hope is that if more people start reading books,
the world will become a better place."
froarulv in afp |
|
| Back to top |
|
 |
Vladimir Grigoriev Guest
|
Posted: Wed Apr 18, 2007 1:44 pm Post subject: Re: About overloading new operator |
|
|
Thanks.
I have an old C program that uses a big structure in which different in fact
"classes" are placed. The structure is used by several tasks. I'd like
rewrite the program as a C++ program and substitute the structure for
classes which allocated in a predefined common memory. This is the first
task.
The second task is that that other "objects" get their memory from a memory
organaised as linked lists.
And the third task is use own allocator for standard containers that also
based on linked lists.
Vladimir Grigoriev
"Hendrik Schober" <SpamTrap (AT) gmx (DOT) de> wrote in message
news:4625318c$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Vladimir Grigoriev <vlad.moscow (AT) mail (DOT) ru> wrote:
Do anybody have any good references for articles about overloading new
operator that based on user defined memory organizations.
I forgot about earlier editions, but in its 3rd,
Scott Meyers "Effective C++" has a whole chapter
about 'new' and 'delete' including at least one
item about overloading them. While I think bying
the book just for this might be a bit overkill,
it's a book every C++ programmer should have read
anyway, so you wouldn't only buy it for this. :)
Vladimir Grigoriev
Schobi
--
SpamTrap (AT) gmx (DOT) de is never read
I'm HSchober at gmx dot org
"My hope is that if more people start reading books,
the world will become a better place."
froarulv in afp
|
|
|
| Back to top |
|
 |
Hendrik Schober Guest
|
Posted: Wed Apr 18, 2007 3:31 pm Post subject: Re: About overloading new operator |
|
|
Vladimir Grigoriev <vlad.moscow (AT) mail (DOT) ru> wrote:
| Quote: | Thanks.
I have an old C program that uses a big structure in which different in fact
"classes" are placed. The structure is used by several tasks. I'd like
rewrite the program as a C++ program and substitute the structure for
classes which allocated in a predefined common memory. This is the first
task.
The second task is that that other "objects" get their memory from a memory
organaised as linked lists.
And the third task is use own allocator for standard containers that also
based on linked lists.
|
I'm not sure I understand all of this right, but here's
what I would do based on what I thought I understood:
I would make it a straight-forward C++ programm which
does its job and is implemented so that it's easily
understood. /Then/ I would check whether it's too slow.
/If/ so, I'd profile. /If/ the slowness turns out to
be caused by memory allocations/deallocations, I'd
look at which classes' allocations cause that. /Then/
I would consider writing one or several allocators for
/those/ classes.
Of course, there are some programs where you know from
experience that this will be necessary. However, you
don't necessarily know /where/ in those programs it is
necessary without profiling. Also, that the design of a
performance-critical app puts performance close to the
top of its list of considerations goes without saying.
But manually tweaking memory management isn't a design
issue and can, in C++, be added later (if needed) without
too much hassle.
HTH.
| Quote: | Vladimir Grigoriev
[...]
|
Schobi
--
SpamTrap (AT) gmx (DOT) de is never read
I'm HSchober at gmx dot org
"My hope is that if more people start reading books,
the world will become a better place."
froarulv in afp |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|