troubleshooting Question

Memory allocation problem

Avatar of tantormedia
tantormediaFlag for United States of America asked on
C++
7 Comments2 Solutions597 ViewsLast Modified:
Dear experts,

In my MFC application, I am trying to allocate memory like this:

short* pLeftoversFromPrevIteration = 0;
...
pLeftoversFromPrevIteration = new short[chunkSize];

I am getting a "Debug Error": Invalid allocation size: 4294967295 bytes.

But in the debugger I can see that chunkSize is 4294889547 bytes which is valid.
Though if I go deeper via Call Stack, I can see:
>      Book.exe!operator new[](unsigned int nSize=4294967295, const char * lpszFileName=0x00a43d54, int nLine=1618)  Line 67 + 0x13 bytes      C++

Could you please explain this to me?

Thanks.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros