Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Leda > Re: allocation ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 131 of 212
Post > Topic >>

Re: allocation memory failure with new operator

by Alexandre Reinhardt <alexandre.reinhardt@[EMAIL PROTECTED] > Jun 2, 2004 at 09:53 AM

Hi,

It would be better for you to allocate smaller memory blocks, instead of
only
one big block. I am not very aware of fine details in the ways modern
operating
systems handle memory, but there is one rule they must follow : memory
within a
memory block must keep continuous, so that it can be fully addressed. So
you
must be sure that you can have all these 1000 MB  you want to allocate fit
into
a single memory chip. Even if this is physically not the problem,
algorithms
within the operating system may be unable to make all this memory fit
within a
continuous block...

So, once again, split your buffer into a few smaller ones.

Hoping this will help,

Alexandre

Alon Hessing wrote:

> Hi,
> I try to allocate memory simply by using the new operator:
>      void* pMem = new unsigned char[1000*1024*1024]
> Notice that I'm trying to allocate 1000 MB in a computer with 2 GB
> memory.
> The allocation fail and the return value is NULL.
> The same allocation succeeded when I doing it from a small test
> program I wrote(and not as a part of my original project).
> I managed to allocate 700MB.
> Do you have any idea what could cause such a behaviour?
> 
> Please help
> 
> Alon
 




 2 Posts in Topic:
allocation memory failure with new operator
alonhes@[EMAIL PROTECTED]  2004-05-31 08:13:47 
Re: allocation memory failure with new operator
Alexandre Reinhardt <a  2004-06-02 09:53:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 19 19:53:13 CDT 2008.