Originally Posted by
BBH
I have a programming question and hope to get your suggestions. I have a C++ program that reads files.
From a preprocessing program, I know the size of the file and how much memory is needed.
Step 1: I get the memory needed from reading a small configuration file and allocate the memory by calling new(). The total mem is around 800M since it is a large network.
Step 2: I read the data file, process the data and write them to the memory.
However, the program is very slow during the reading file and filling the data. The whole machine has 4G mem. It is CentOS and program is in C++, compiled by g++.
I tried reading the file only, doing simple operations and not writing them into the mem. It is fast. Seems the memory allocation is slow?
Any suggestion is appreciated.
BBH