[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: More than 2, but less than 3 GiB per process memory?



Am Freitag, 23. September 2005 14:45 schrieben Sie:
> However, our test case for this terminates when trying to allocate more
> than 2 GiB of memory, even though we have a really big swap file.

BTW, this is our test case, in case you're interested:

#include <iostream.h>

class test {
        int t1;
        int t2;
        int t3;
        int t4;
        int t5;
        int t6;
};


int main() {
        class test *test_p;
        for (int i = 42; i < 900000000; i += 3000000) {
                try {
                        cout << "Size: " << i << " sizeof: "
                                << sizeof(test) << " Total: " <<
                                i*sizeof(test) / (1024*1024)
                                << "M" << endl;
                        test_p = new test[i];
                } catch (...) {
                        test_p = 0;
                }
                if (!test_p) {
                        cout << "Oops. out of memory" << endl;
                        exit(1);
                }
                free(test_p);
        }
}

/* compile me with: g++ memcheck.cpp -o memcheck */



Reply to: