Hello. The first thing you need to do when you optimize your program is determining it's slowest part. Profilers like gprof can help you in this problem. It's recommended to profile a real program on real input data rather use small testing code. If you think that the problem is with the slow malloc function - I think you should talk to glibc developers about this. If you need to increase the array access speed you can try some simple methods. 1) store an array of pointers to the beginning of every row. You'll lose time creating it, but access will be faster 2) for the consecutive access (like in the sample code) you can use a single pointer instead of (i, j): for (p = buffer1; p < buffer1 + 250 * 1000000; p++) *p = 0; Also try to turn optimizing switches on (like -O4).