c++ - why malloc always failed allocate memory (roughtly 9GB but I have 16GB physical memory)? -
i believe have enough memory (16g) allocation in ubuntu (64 bit application). still return null.
following memory information running free command.
total used free shared buffers cached mem: 16376100 3295024 13081076 41936 88852 1073808 -/+ buffers/cache: 2132364 14243736 swap: 15998972 0 15998972
screenshot:
based on comment, figured out. that's because when calculate memory size, sum overflowed.
another case use int n_dataset = 2453688725;
overflowed, n_dataset
negative number.
Comments
Post a Comment