First post, by keenmaster486
- Rank
- l33t
It doesn't seem to matter if I compile with the -mh param and/or use the huge modifier or not, if I try to allocate memory for a huge array of chars, I get all sorts of weird behaviors that are symptomatic of it never having actually allocated the memory.
That's one issue, but another trouble is that I can't seem to catch any bad_alloc exceptions. Maybe I'm doing it wrong? I'm a little fuzzy on how this works. Yes I'm enabling exceptions with -xs.
I can't even cause an exception if I catch all exceptions with catch (...) and try to allocate some ridiculous amount of memory, like several gigabytes, to a near or far pointer. What gives?
Example of what I'm trying to do:
unsigned char huge *hugePointer = NULL;
void allocateMemory() {
try {
hugePointer = new unsigned char[80000]; // some number greater than 65535
} catch (bad_alloc) {
cout<<"Out of memory"<<endl;
}
}
World's foremost 486 enjoyer.