[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Freeing up memory used by GSL matrix
From: |
adarsh |
Subject: |
[Help-gsl] Freeing up memory used by GSL matrix |
Date: |
Mon, 12 Jun 2006 00:15:42 -0500 (CDT) |
User-agent: |
SquirrelMail/1.4.5 |
I am trying to figure out a way to efficiently free the memory after a gsl
matrix is no longer being used. Of course, one could call
gsl_matrix_free(). However in my case, the block pointer may or may not be
allocated.
A code snippet follows:
gsl_matrix *matQ_temp = gsl_matrix_alloc(1,1);
gsl_block_free(matQ_temp->block);
matQ_temp->blcok = 0;
if (matQ_temp->block!=0){
std::cout<<"true"<<std::endl;
gsl_matrix_free(matQ_temp);
}
else{
std::cout<<"false"<<std::endl;
free(matQ_temp->data);
}
When running this I get the following o/p:
false
*** glibc detected *** double free or corruption (!prev): 0x081b39a8 ***
Aborted
I thought even after gsl_block_free has been called, the data pointer
needs to be freed. If yes, then why am I getting this error? Or does
gsl_block_free() automatically free the data pointer as well?
Also, is there anything else I need to do to free the memory?
Thanks,
Adarsh
- [Help-gsl] Freeing up memory used by GSL matrix,
adarsh <=