该文件包含2000000行数据,每一行包含208个用逗号分隔的列,如下所示:
我对为什么我的程序会消耗如此多的内存感到困惑?
0.0863314058048,0.0208767447842,0.03358010485,0.0,1.0,0.0,0.314285714286,0.336293217457,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0程序将此文件读入numpy数组,我原本预计它会消耗大约
(2000000 * 208 * 8B) = 3.2GB
的内存。但是,在程序读取该文件时,我发现程序占用了约20GB的内存。我对为什么我的程序会消耗如此多的内存感到困惑?