help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] malloc error


From: M Atakan Gurkan
Subject: Re: [Help-gsl] malloc error
Date: Fri, 15 Jul 2005 11:54:32 -0500
User-agent: Mutt/1.2.5.1i

hello,

in this page:
http://www.gnu.org/software/gsl/manual/gsl-ref_34.html

under "Initializing solver", there are functions for
freeing a solver. Go there and search for "_free".

ato

On Fri, Jul 15, 2005 at 01:16:16PM +0200, Stefan Bernhard wrote:
> Hello,
> 
> I do use a nonlinear root solver for one equation which is called  
> several times in a loop j<J, which is inside a loop
> m_itr<M wich is inside a loop ntr<N. The code looks like this
> 
> for (int ntr=0; ntr<N;ntr++)
> {
> for (int m_itr=0; m_itr<M;m_itr++)
> {
> for (int jtr=0; jtr<J;jtr++)
> {
> 
> ......
> // upper and lower bound              
> m_ddelta_lo = 1e-14;
> m_ddelta_hi = 0.9*m_ppdRad[m_itr][2][jtr];
>                                                       
> m_dpart =  
> m_pgenPar->m_dnu*m_dX/(m_ppdad[m_itr][2][jtr]*m_ppdux[m_itr][2][jtr]);
> 
> BLA_params params = {m_dpart, m_ppdad[m_itr][2][jtr],  
> m_ppdLp[m_itr][2][jtr],m_ppdRad[m_itr][2][jtr]*m_ppdZetax[m_itr][2][jtr] 
> , m_dC2};
> 
> BF.function = &BLA;
> BF.params = &params;
>                               
> BT = gsl_root_fsolver_brent;
> bs = gsl_root_fsolver_alloc (BT);
> gsl_root_fsolver_set (bs, &BF, m_ddelta_lo, m_ddelta_hi);
> 
> 
> m_niter = 0;
>                                       
> do                                    
> {
>                                               
> m_niter++;
>                                               
> m_nstatus = gsl_root_fsolver_iterate (bs);
>                                               
> m_dsol = gsl_root_fsolver_root (bs);
>                                               
> m_ddelta_lo = gsl_root_fsolver_x_lower (bs);
>                                               
> m_ddelta_hi = gsl_root_fsolver_x_upper (bs);
>                                               
> m_nstatus = gsl_root_test_interval (m_ddelta_lo, m_ddelta_hi,  
> m_depsabs, m_depsrel);                                
> }                             
> while (m_nstatus == GSL_CONTINUE && m_niter < m_niter_max);
>                                                                       
> m_ppdDeltaS[m_itr][2][jtr] = m_dsol;
> 
> }
> }
> }
> 
> The variable declaration was done in a header file and initialisation  
> was done bevore in the .cpp file. However the solver performs well for  
> small N but for larger N it returns the following error Message:
> 
> *** malloc: vm_allocate(size=1069056) failed (error code=3)
> *** malloc[1374]: error: Can't allocate region
> gsl: fsolver.c:44: ERROR: failed to allocate space for root solver state
> Default GSL error handler invoked.
> Abort
> 
> 
> My Question is: Does the solver free the memory before it is called  
> again? How can I force the solver to free the memory after each call?
> 
> 
> Thak you.
> 
> Stefan Bernhard
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]