forum.alglib.net
http://forum.alglib.net/

Program crash in ae_frame_leave, need help.
http://forum.alglib.net/viewtopic.php?f=2&t=585
Page 1 of 1

Author:  e1212dison [ Mon Jun 04, 2012 1:23 pm ]
Post subject:  Program crash in ae_frame_leave, need help.

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!

Author:  e1212dison [ Mon Jun 04, 2012 1:30 pm ]
Post subject:  Re: Program crash in ae_frame_leave, need help.

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?

Author:  e1212dison [ Tue Jun 05, 2012 7:50 am ]
Post subject:  Re: Program crash in ae_frame_leave, need help.

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)!!!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/