forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 11:30 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Program crash in ae_frame_leave, need help.
PostPosted: Mon Jun 04, 2012 1:23 pm 
Offline

Joined: Mon Jun 04, 2012 12:49 pm
Posts: 3
Hi, I'm working on a project using ALGLIB's 2d spline interpolation utility, and tested the two function "spline2dbuildbicubic" and "spline2dcalc" well through a simple example.
But in the big project I have some bad happens, and it happens on the ALGLIB:
when I call spline2dbuildbicubic, the error"
*** glibc detected *** ./VRTCaculate: double free or corruption (!prev): 0x00000000008e5fc0 ***
drop out my screen.

I follow the track:
spline2dbuildbicubic Interpolation.cpp line 9030 --> alglib_impl::ae_state_clear at ap.cpp line 330 --> ae_frame_leave ap.cpp line 372

finally found program crashed somewhere inside ae_frame_leave's while statements:

void ae_frame_leave(ae_state *state)
{
while( state->p_top_block->ptr!=DYN_FRAME && state->p_top_block->ptr!=DYN_BOTTOM)
{
if( state->p_top_block->ptr!=NULL && state->p_top_block->deallocator!=NULL)
______((ae_deallocator)(state->p_top_block->deallocator))(state->p_top_block->ptr);
state->p_top_block = state->p_top_block->p_next; //<------here

}
state->p_top_block = state->p_top_block->p_next;
}

The code here is confuse to me, and I think may hide a bug:
if( state->p_top_block->ptr!=NULL && state->p_top_block->deallocator!=NULL)
we deallocate
then we point p_top_block to p_top_block->p_next without considering whether (state->p_top_block->ptr==NULL) ???

So is there any suggestions about this? I'm crasy for one whole day but digging nothing out. Thanks!


Top
 Profile  
 
 Post subject: Re: Program crash in ae_frame_leave, need help.
PostPosted: Mon Jun 04, 2012 1:30 pm 
Offline

Joined: Mon Jun 04, 2012 12:49 pm
Posts: 3
Or someone can explain what the "alglib_impl::ae_state_clear" for?
This should not be the kernel code of spline interpolation, can I just comment it?


Top
 Profile  
 
 Post subject: Re: Program crash in ae_frame_leave, need help.
PostPosted: Tue Jun 05, 2012 7:50 am 
Offline

Joined: Mon Jun 04, 2012 12:49 pm
Posts: 3
Problem solved, I confused the X-Y dimention of:
void spline2dbuildbicubic(
ae_vector* x,
ae_vector* y,
ae_matrix* f,
ae_int_t m,
ae_int_t n,
spline2dinterpolant* c,
ae_state *_state);

X's dimention is n, Y's is m.
Be careful here, ALGLIB have different sequence of name(X, Y) and its dimention(n, m)!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group