Per
12/5/2008 12:18:00 PM
On 2008-12-05, joecook@gmail.com <joecook@gmail.com> wrote:
> On Dec 5, 8:01 am, fabian....@gmail.com wrote:
>> std::allocator will throw a std::bad_alloc exception, when it does the
>> array will be about size 40,000. Are they are ways to increase the
>> amount of memory my program can use?
>
> This is OS dependant, and unrelated to c++. Unfortunately, the
> answer is probably 'no'.
>
> Because of the way resize() works, you may be trying to allocate more
> memory than you really need. If you know in advance what the maximum
> is, you can try using resize() to pre-allocate the memory.
Perhaps a std::list will suffice in that case since no extra memory
space will be allocated beforehand. Or perhaps a std::deque will not
allocatede the same amount of memory.
/Per