user3287625
user3287625

Reputation: 9

Invalid allocation size: 4294967295 bytes

I'm trying to build my first C++ app and I'm trying to browse a table. However, the debugger display this error message.

DWORD *dwWatch = new DWORD[taille]; // <-- The error appears here.
for (LISTSTR::iterator i = listMe.begin(); i != listMe.end(); ++i, j++)
    {
        dwWatch[j] = m_DirWatcher.WatchDirectory(m_strDirectoryToMonitor, dwChangeFilter, pHandler, true, NULL, NULL);

    }

How do I fix this, please ?

Upvotes: 0

Views: 2404

Answers (1)

Cruise Liu
Cruise Liu

Reputation: 576

The real value of taille is -1, because 4294967295 of unsigned int and -1 of signed int are both 0xffffffff in memory.

So check out when did its value change to -1. Note that some standard functions return -1 on fail.

Upvotes: 2

Related Questions