Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 701819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:39:08+00:00 2026-05-14T03:39:08+00:00

I’ve been writing a multi-threaded DLL for database access using ADO/ODBC for use with

  • 0

I’ve been writing a multi-threaded DLL for database access using ADO/ODBC for use with a legacy application. I need to keep multiple database connections for each thread, so I’ve put the ADO objects for each connection in an object and thinking of keeping an array of them inside a custom threadInfo object. Obviously a vector would serve better here – I need to delete/rearrange objects on the go and a vector would simplify that. Problem is, I’m allocating a heap for each thread to avoid heap contention and stuff and allocating all my memory from there.

So my question is: how do I make the vector allocate from the thread-specific heap? (Or would it know internally to allocate memory from the same heap as its wrapper class – sounds unlikely, but I’m not a C++ guy) I’ve googled a bit and it looks like I might need to write an allocator or something – which looks like so much of work I don’t want. Is there any other way? I’ve heard vector uses placement-new for all its stuff inside, so can overloading operator new be worked into it?

My scant knowledge of the insides of C++ doesn’t help, seeing as I’m mainly a C programmer (even that – relatively). It’s very possible I’m missing something elementary somewhere. If nothing easier comes up – I might just go and do the array thing, but hopefully it won’t come to that.

I’m using MS-VC++ 6.0 (hey, it’s rude to laugh! 😛 ).

Any/all help will be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:39:09+00:00Added an answer on May 14, 2026 at 3:39 am

    how do I make the vector allocate from the thread-specific heap?

    You pass it (at compile-time) an appropriate allocator. Here is a classic on how to do so. If you follow that article’s advice (or even just copy the code and adapt it where needed), for a C programmer writing an allocator might be easier than getting right the copy semantics of a class with a dynamically allocated array.

    Note that, if you put objects into the vector (or your own array, FTM), which themselves use the heap (strings, for example), you need to take that they use your special heap, too. For containers of the standard library (std::basic_string<> is such a container) it’s easy since you can pass them your allocator as well. For your own types you have to make that sure yourself.

    And try to get away from VC6 as fast as possible. It’s poisonous.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 370k
  • Answers 370k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Making the request asynchronous would allow for better scalability of… May 14, 2026 at 6:33 pm
  • Editorial Team
    Editorial Team added an answer After some investigation, it appears that my C++ app is… May 14, 2026 at 6:33 pm
  • Editorial Team
    Editorial Team added an answer Version 2 is what I'd go with, as there's (presumably)… May 14, 2026 at 6:33 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.