Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REDSVM - Possible memory leak #71

Open
Anthares101 opened this issue May 21, 2020 · 2 comments
Open

REDSVM - Possible memory leak #71

Anthares101 opened this issue May 21, 2020 · 2 comments
Assignees

Comments

@Anthares101
Copy link

Migrating REDSVM to ORCA-Python i detected a memory leak during the execution of the algorithm. The problem looks like is this part of the svm_free_model_content function:

if(model_ptr->free_sv && model_ptr->l > 0 && model_ptr->SV != NULL)
free((void *)(model_ptr->SV[0]));

This code only free the memory of the first SV but not the rest of them. Changing that to:

if(model_ptr->free_sv && model_ptr->l > 0 && model_ptr->SV != NULL){
	for(int i=0;i<model_ptr->l;i++)
			free((void *)(model_ptr->SV[i]));
}

Solved the problem for me.

@Anthares101 Anthares101 changed the title REDSVM possible memory leak REDSVM - Possible memory leak May 21, 2020
@javism
Copy link
Contributor

javism commented May 21, 2020

Thanks @Anthares101! Let me test the patch and I'm merge the change.

@javism javism self-assigned this May 21, 2020
javism added a commit that referenced this issue May 21, 2020
@javism
Copy link
Contributor

javism commented May 21, 2020

This works in Matlab 2018a but produces a segfault in Octave. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants