Dynamic memory failure reason

A

Attila Feher

Sanjeev said:
What could be the reasons for dynamic memory allocation failure (in
vc++, using new statement) when the memory has more than 1 GB of
unused RAM space?

I am afraid that the standard C++ language has not answer to that question.
You will need to ask this in a Windows programming newsgroup. It smells
like you need to set/enable something platform specific.
 
V

Victor Bazarov

Attila said:
I am afraid that the standard C++ language has not answer to that question.
You will need to ask this in a Windows programming newsgroup. It smells
like you need to set/enable something platform specific.

While it is truly platform-specific, often, and on many platforms,
the failure to allocate a chunk of memory while the OS still reports
some amount free is due to the fragmentation of the memory causing
inability of the execution environment to give you a *contiguous*
piece you're requesting.

V
 
J

Jonathan Bartlett

While it is truly platform-specific, often, and on many platforms,
the failure to allocate a chunk of memory while the OS still reports
some amount free is due to the fragmentation of the memory causing
inability of the execution environment to give you a *contiguous*
piece you're requesting.

That shouldn't be too much of a problem given that the O/S can map free
memory pages however it wants.

Jon
 
P

Peter Koch Larsen

Sanjeev Kumar said:
What could be the reasons for dynamic memory allocation failure (in
vc++, using new statement) when the memory has more than 1 GB of
unused RAM space?


Regards,
Sanjeev
http://coolcampus.8k.com

As Victor said, one reason could be fragmentation. Another reason could be
that you somehow screwed up your memory manager or (os-specific) that your
program was assigned a limit not allowing it to use all memory.

/Peter
 
I

Ioannis Vranos

Peter said:
As Victor said, one reason could be fragmentation. Another reason could be
that you somehow screwed up your memory manager or (os-specific) that your
program was assigned a limit not allowing it to use all memory.


That reminds me what I had read recently about Win64, that it will
maintain all 32-bit APIs like Win32 for backward compatibility, as is
the case of Win16 today, and each 32-bit application will be assigned 1
GB of maximum memory, while today the maximum memory of such an
application is less (however I do not recall how much and where I read
it - perhaps the current limit is 512 MB).


Perhaps the OP is trying to surpass this memory limit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top