What is the limit on malloc parameter of type size_t in C? Docs say it has an upper limit of UINT_MAX but I can't go beyond INT_MAX
问题 I want to allocate a 2.9GB char array with database = (char*) malloc((2900 * 1000000 * sizeof(char))); This gives an integer overflow warning and the malloc returns NULL . The malloc parameter is of type size_t which according to documentation is of type unsigned int . So the max should be UINT_MAX which is at least 2.9GB. However, if I try to allocate more than MAX_INT the malloc fails. Does this mean size_t on my system is of type int? How do I check this? I looked through /usr/include