STL pool allocator performing very slow!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mavrik
    New Member
    • Jan 2007
    • 12

    STL pool allocator performing very slow!

    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
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    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.

    Comment

    • mavrik
      New Member
      • Jan 2007
      • 12

      #3
      Originally posted by weaknessforcats
      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..

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        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++.

        Comment

        • mavrik
          New Member
          • Jan 2007
          • 12

          #5
          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

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            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?

            Comment

            • mavrik
              New Member
              • Jan 2007
              • 12

              #7
              Hello,

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

              -Thanks

              Comment

              Working...