512kB array won't compile, "internal heap limit reached"...

Started by
12 comments, last by bubu LV 12 years, 9 months ago
That's a fine and dandy code snippet.

Unfortunately, it doesn't seem to have anything to do with the compilation issue you're having... ?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Advertisement
the problem was when im trying to include a file with the cipher in a text file instead of using a binary one, the file is too big and compiler complain. For example, the text file looked like this:

BYTE MyCipher[CIPHER_LENGTH] = {
0x8D, 0x97, 0xD2, 0x83, 0xCD, 0x8F, 0xC0, 0xF9, 0x6C, 0xD5, 0xFE, 0x1F, 0x34, 0xD6, 0x11, 0x3A,
0xCE, 0x9C, 0xEC, 0xF2, 0xB5, 0x52, 0x20, 0x77, 0x63, 0xA1, 0x62, 0x90, 0x1A, 0x9F, 0x7F, 0xA9,
0x6A, 0xC5, 0x30, 0x26, 0x81, 0x43, 0xAD, 0xA5, 0xBA, 0x7B, 0x92, 0x1B, 0x3A, 0xEB, 0x48, 0x99,
// ... and so on

i extracted this using the "Copy as Text" from an hexEditor, but the file make almost 4mo in text mode, instead of 512k in binary, i think that's why the compiler is complaining. What im trying to do is to get rid of the binary file and embeed the data into the executable itself. I think i should try using a ressource file instead.
Yeah, sounds like a prime candidate for a resource :-)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Given your requirements, a much smaller key will probably be as secure and less hassle.
4MB source file and 512KB should not be too large for MSVC compiler.
At work we are using 22MB generated source code that includes several large (up to 2 MB) generated data tables. It compiles just fine without any /Zm switch.

Does your MyCipher array changes? try adding static const modifiers. Then include header with large array into your cpp file and use it directly without any memcpy.

This topic is closed to new replies.

Advertisement