473,834 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

STL pool allocator performing very slow!

12 New Member
Hi All,

I've created STL allocator which creates memory pool in the beginning, and all maps and vectors will take memory from that memory pool.

But...I am observing that application has become drastically slow.
I was under impression that after implemeting pool, application will fasten, but it is doing other ways.

I've implemeted doubly linked list to maintain the nodes occupied or free in the pool.

My C++ application was able to insert 40000 records in Oracle DB in 5 min. if they use default allocators, and now it can only insert 5000 records.

Has anybody faced this kind of problem with custom allocators of memoty pool.
-Thanks
-Mavrik
Apr 9 '08 #1
6 2754
weaknessforcats
9,208 Recognized Expert Moderator Expert
It's probably the linked list that's the problem. Try implementing a heap. That is, a tree where the distance from the root to farthest leaf nodes is constant.

You have to avoid traipsing about in a linked list when managing memory. You don't have the time luxury.
Apr 9 '08 #2
mavrik
12 New Member
It's probably the linked list that's the problem. Try implementing a heap. That is, a tree where the distance from the root to farthest leaf nodes is constant.

You have to avoid traipsing about in a linked list when managing memory. You don't have the time luxury.
Hi.. Thanks for ur response.
I am not able to understand that how to go ahead with Tree implementation.
I also want to understand what u mean by saying "the distance from the root to farthest leaf nodes is constant".
Can u elaborate it... also guide me how to design it..
Thanks a lot..
Apr 10 '08 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
Check out Algorithms in C++ by Robert Sedgewick ISBN 0-201-51059-6.

What you want be between pages 148-183.

The examples are all in C++.
Apr 10 '08 #4
mavrik
12 New Member
Hi Weaknessforcats ,

Can you help me in getting this book "Algorithms in C++ by Robert Sedgewick ISBN 0-201-51059-6".
Actually this book is very very costly on Amazon. And I can not afford it right now.
I could not find a softcopy over net.

If you have this, can I get a soft copy from you??
Thanks
Apr 25 '08 #5
weaknessforcats
9,208 Recognized Expert Moderator Expert
It's copyrighted material. There are legal issues around making copies of copyrighted material and failing to pay the author.

Have you tried the public library?
Apr 25 '08 #6
mavrik
12 New Member
Hello,

No I did not try public Library....Anyw ays thanks a lot for all the help you have provided so far.

-Thanks
May 6 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
7229
by: Philip Lawatsch | last post by:
Hi, I have some questions about whats written in http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.14 (Describing some memory pool) #1 From what i understand this will also work for new x and delete x, or did i misunderstand something ? and,
8
1821
by: ra294 | last post by:
I have an ASP.net application using SQL Server 2000 that every once in a while I am getting this error: "System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached" I looked at my code and It seems that I do close every connection that I open so I don't know why I am getting...
0
1673
by: roni schuetz | last post by:
since a few day's i'm running around the problem that I stocked with a change i need to do. hopefully somebody here can give me a tipp which will be usefull to solve my problem. I'm using a thread-pool within my WebSite which done some requests to several interfaces the readed data will be added to the cache. This operations consumes much CPU and I want to have this outside my website so i decided to change the flow. It should looks...
2
3214
by: Jerry Adair | last post by:
Hi, I have been playing around with the suggestions and code shown in http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.14 regarding memory allocation/deallocation (mem pools). I think I understand what the FAQ was getting at (emphasis on "think") so I concluded that attempting to make a delete statement on an area of memory that was created in a pool with the placement new operator (overloaded) would not allow me to
0
1315
by: joe | last post by:
I have created a custom allocator for a multiset, and I am having a problem it seems because while the allocator has memory available to be used which is returned, the objects are never constructed on top of that memory. I expected my "construct" method to be called to handle this, but no one calls it. No more than MAX_OBJS object of class Obj will ever be allocated. #include<iostream> #include <set>
11
2825
by: Grey Alien | last post by:
I am looking to write a very simple memory pool library to store only one data type at a time - i.e. to provide a contiguous block of memory to be alloc'd free'd by the calling program. I am I have come up with this API so far and will welcome any feedback on it. In particular, I will need help with implementing the linked lists used for record keeping as to which blocks were free or not (and for "defragging" the pool when "holes"...
6
13863
by: Juha Nieminen | last post by:
I tested the speed of a simple program like this: //------------------------------------------------------------ #include <list> #include <boost/pool/pool_alloc.hpp> int main() { typedef std::list<intList_t; // default allocator //typedef std::list<int, boost::pool_allocator<int List_t;
16
5108
by: graham.keellings | last post by:
hi, I'm looking for an open source memory pool. It's for use on an embedded system, if that makes any difference. Something with garbage collection/defragmentation would be nice. It should have the ability to allocate different size chunks of memory not just a single size. It should error check for double free, etc. And it should be usable by a mixture of C and C++ subsystems. If I get that, I'm happy. Thank you very much.
17
1624
by: a_linux_user | last post by:
I am creating a large graph object in which I add nodes whenever I need them, and I create them by 'new node' individually. I know this is slow if I am going to allocate thousands of nodes individually. I want to replace this allocation by an allocation from a pool. One simple method I can think of is a manual allocation of a large array of nodes (since I have an estimate of how many nodes there will be), and use pointers to array...
0
9649
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10799
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10515
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10554
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9338
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5629
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4428
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3985
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.