Hello,
Since I upgrade my PC from perl 5.8.8 to 5.10.0, my application fails.
I do not understand what is going on, memory leak ?
Segmentation fault.
I noticed warning which did not happen before:
Please specify prototyping behavior for Fitter.xs (see perlxs manual)
g++ -c -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables -DPERL_USE_SAFE_PUTENV
-DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC
"-I/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE" Fitter.c
Fitter.c: In function ‘void XS_Fitter_new(PerlInterpreter*, CV*)’:
Fitter.c:76: warning: unused variable ‘CLASS’
Fitter.c:57: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_DESTROY(PerlInterpreter*,
CV*)’:
Fitter.c:187: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_Rot_QN(PerlInterpreter*,
CV*)’:
Fitter.c:216: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_SR_sizes(PerlInterpreter*,
CV*)’:
Fitter.c:248: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_IR_sizes(PerlInterpreter*,
CV*)’:
Fitter.c:281: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_mu_type(PerlInterpreter*,
CV*)’:
Fitter.c:318: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_RR_sizes(PerlInterpreter*,
CV*)’:
Fitter.c:348: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void
XS_FitterPtr_Set_line_coeff(PerlInterpreter*, CV*)’:
Fitter.c:381: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_Cutoff(PerlInterpreter*,
CV*)’:
Fitter.c:412: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_Range(PerlInterpreter*,
CV*)’:
Fitter.c:442: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Set_Control(PerlInterpreter*,
CV*)’:
Fitter.c:473: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Init_RR(PerlInterpreter*,
CV*)’:
Fitter.c:505: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Init_SR(PerlInterpreter*,
CV*)’:
Fitter.c:534: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Init_IR(PerlInterpreter*,
CV*)’:
Fitter.c:564: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Calcul(PerlInterpreter*,
CV*)’:
Fitter.c:594: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Chi2(PerlInterpreter*, CV*)’:
Fitter.c:626: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Get_Chi2(PerlInterpreter*,
CV*)’:
Fitter.c:658: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void
XS_FitterPtr_Init_perl_call(PerlInterpreter*, CV*)’:
Fitter.c:690: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Get_Sigma_max(PerlInterpreter*,
CV*)’:
Fitter.c:720: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void XS_FitterPtr_Fit(PerlInterpreter*, CV*)’:
Fitter.c:752: warning: unused variable ‘Perl___notused’
Fitter.c: In function ‘void boot_Fitter(PerlInterpreter*, CV*)’:
Fitter.c:815: warning: deprecated conversion from string constant to
‘char*’
Fitter.c:811: warning: unused variable ‘Perl___notused’
Fitter.xs: In function ‘void XS_Fitter_new(PerlInterpreter*, CV*)’:
Fitter.xs:61: warning: ‘data_y’ may be used uninitialized in this
function
Fitter.xs:61: note: ‘data_y’ was declared here
Fitter.xs:60: warning: ‘data_x’ may be used uninitialized in this
function
Fitter.xs:60: note: ‘data_x’ was declared here
Fitter.xs:52: warning: ‘size’ may be used uninitialized in this
function
Fitter.xs:52: note: ‘size’ was declared here
Running Mkbootstrap for Fitter ()
Could it be related ?
It looks like that the variable that I created with the constructor
just disappear, ie. is not accessible !
Maybe I should add that perl call a cpp class.
Is their some changes between 5.8.8 and 5.10.0 ?
this is the xs file for the constructor:
Fitter *
Fitter::new (param, constrains, x, y, weight, w_y)
AV *param
AV *constrains
AV *x
AV *y
int weight
AV *w_y
PREINIT:
unsigned int i, size ;
SV **elem ;
CODE:
std::vector<double> array_val ;
std::vector<int> array_const ;
double *data_x ;
double *data_y ;
std::vector<double> data_var_y ;
if (av_len (param) != av_len (constrains)) {
printf ("PB in the length of the parameter arrays\n") ;
}
else {
size = av_len (param) + 1 ;
array_val.resize (size) ;
array_const.resize (size) ;
for (i = 0 ; i < size ; i++) {
elem = av_fetch (param, i, 0) ;
if (elem == NULL) {
array_val [i] = 0 ;
}
else {
array_val [i]= SvNV (*elem) ;
}
elem = av_fetch (constrains, i, 0) ;
if (elem == NULL) {
array_const [i] = 0 ;
}
else {
array_const [i]= SvIV (*elem) ;
}
}
if (av_len (x) != av_len (y)) {
printf ("PB in the length of the data\n") ;
}
else {
size = av_len (x) + 1 ;
data_x = (double *) malloc (size * sizeof (double)) ;
data_y = (double *) malloc (size * sizeof (double)) ;
for (i = 0 ; i < size ; i++) {
elem = av_fetch (x, i, 0) ;
data_x [i]= SvNV (*elem) ;
elem = av_fetch (y, i, 0) ;
data_y [i]= SvNV (*elem) ;
}
}
if (weight != 0) {
if (av_len (w_y) != av_len (y)) {
printf ("PB in the length of the weight data\n") ;
}
else {
data_var_y.resize (size) ;
for (i = 0 ; i < size ; i++) {
elem = av_fetch (w_y, i, 0) ;
data_var_y [i]= SvNV (*elem) ;
}
}
}
}
RETVAL = new Fitter (array_val, array_const, data_x, data_y,
data_var_y, size, weight) ;
OUTPUT:
RETVAL
Regards
--
---
==========================================================================
Patrick DUPRÉ | |
Department of Chemistry | | Phone: (44)-(0)-1904-434384
The University of York | | Fax: (44)-(0)-1904-432516
Heslington | |
York YO10 5DD United Kingdom | | email: [EMAIL PROTECTED]
==========================================================================
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/