|
|
|
|
|
|
| Author |
Message |
Kai-Uwe Bux *nix forums Guru
Joined: 06 May 2005
Posts: 627
|
Posted: Fri Jul 21, 2006 12:40 pm Post subject:
Re: making STL use " __malloc_alloc_template<0> "
|
|
|
jithoosin wrote:
| Quote: | Hi
I am using STL in my code. So after some time it appears as if the
code is leaking memory. I did a memory profiling using valgrind massif
to find out that most memory in my code is allocated using the 2
functions
1) std::__default_alloc_template<true, 0>::allocate(unsigned) (in
/usr/lib/libstdc++.so.5.0.3)
2) std::__default_alloc_template<true, 0>::_S_chunk_alloc(unsigned,
int&) (in /usr/lib/libstdc++.so.5.0.3)
When i googled i found a useful reference:
http://www-1.ibm.com/support/docview.wss?rs=994&context=SSSHAD&dc=DB520&uid=swg21160634&loc=en_US&cs=UTF-8&lang=en
It asks me to use __malloc_alloc_template<0> in my code so that STL
|
The standard does not require _malloc_alloc_template<0> to exist. This is a
feature of the particular STL implementation you are using.
| Quote: | "actualy frees" memory. So I have 2 questions .
1)Would this strategy be helpful ?
|
Who knows? Maybe you should ask in a forum for the particular STL
implementation you are using. Here, platform specific questions are
off-topic.
| Quote: | 2) Is there any easy way to make my code use this template by any
options rather than changing the code as the link suggests ?
|
Again, who knows.
However, there maybe a more portable way to achieve what you want: all
standard containers do all their allocations by means of an allocator,
which defaults to std::allocator<>. You can provide your own allocator
instead.
Best
Kai-Uwe Bux |
|
| Back to top |
|
 |
jithoosin *nix forums beginner
Joined: 21 Jul 2006
Posts: 6
|
Posted: Fri Jul 21, 2006 6:03 am Post subject:
making STL use " __malloc_alloc_template<0> "
|
|
|
Hi
I am using STL in my code. So after some time it appears as if the
code is leaking memory. I did a memory profiling using valgrind massif
to find out that most memory in my code is allocated using the 2
functions
1) std::__default_alloc_template<true, 0>::allocate(unsigned) (in
/usr/lib/libstdc++.so.5.0.3)
2) std::__default_alloc_template<true, 0>::_S_chunk_alloc(unsigned,
int&) (in /usr/lib/libstdc++.so.5.0.3)
When i googled i found a useful reference:
http://www-1.ibm.com/support/docview.wss?rs=994&context=SSSHAD&dc=DB520&uid=swg21160634&loc=en_US&cs=UTF-8&lang=en
It asks me to use __malloc_alloc_template<0> in my code so that STL
"actualy frees" memory. So I have 2 questions .
1)Would this strategy be helpful ?
2) Is there any easy way to make my code use this template by any
options rather than changing the code as the link suggests ?
Thanks in advance.
Regards
Kiran Pradeep |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Nov 20, 2008 8:13 am | All times are GMT
|
|
Acer Monitors | Mortgage Calculator | Best Credit Cards | Best Credit Cards | New Cars
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|