kernel 2.6.7 and Electric Fence (fwd)
Paweł Gołaszewski
blues w pld-linux.org
Czw, 28 Paź 2004, 11:18:14 CEST
--
pozdr. Paweł Gołaszewski
---------------------------------
If you think of MS-DOS as mono, and Windows as stereo,
then Linux is Dolby Pro-Logic Surround Sound with Bass Boost
and all the music is free.
---------- Forwarded message ----------
Date: Thu, 28 Oct 2004 09:16:41 +0200
From: Zbyszek P. Karkuszewski <zbyszek w drum.if.uj.edu.pl>
To: feedback w pld-linux.org
User-Agent: Mutt/1.2.5.1i
Subject: kernel 2.6.7 and Electric Fence
Hi Guys,
I am writing this message in English because it might be of interest to a wider
linux community.
There is a strange behavior of Electric Fence 2.2.2 when applied to
a primitive C code (attached bellow). It returns the following error message:
ElectricFence Exiting: mprotect() failed: Cannot allocate memory
The program has been compiled with gcc-3.3.5; glibc version is 2.3.4;
kernel 2.6.7.
The same thing happens with older versions of these packages and on
several different hardware architectures. Size of the RAM is not an issue
here, it was way greater than a sufficient for the program + efence.
The troublesome line is
bm[i] = (double *)malloc((time_t)kmax*sizeof(double));
at i of order of 20k.
The author of efence, Bruce Perens, suspects some limitations of the linux
kernels.
Did you ever come across such limitations that could be responsible
for the error message above?
Here is the source code:
#define N 100
#include<stdlib.h>
double **bm;
int main(){
int i;
long NN = 4*N*N;
int kmax=100;
bm = (double **)malloc((time_t)NN*sizeof(double *));
for(i=0; i<NN; ++i){
bm[i] = (double*)malloc((time_t)kmax*sizeof(double));
}
for(i=0; i<NN; ++i){
free(bm[i]);
}
free(bm);
return 0;
}
I compile it with
gcc tmp.c -lefence
Cheers!
zbyszek
_______________________________________________
feedback mailing list
feedback w pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/feedback
Więcej informacji o liście dyskusyjnej pld-devel-pl