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

std::bad_alloc in anms.h #4

Closed
drondao opened this issue Apr 13, 2019 · 1 comment · Fixed by #5
Closed

std::bad_alloc in anms.h #4

drondao opened this issue Apr 13, 2019 · 1 comment · Fixed by #5
Labels

Comments

@drondao
Copy link
Contributor

drondao commented Apr 13, 2019

In "anms.h", the following line assigns c = 0 when width = 1 because of integer division:

double c = width/2; //initializing Grid

This causes the assignment of infinity to

int numCellCols = floor(cols/c);
int numCellRows = floor(rows/c);

which, in turn, returns an std::bad_alloc exception because of the call

std::vector<std::vector<bool> > coveredVec(numCellRows+1,std::vector<bool>(numCellCols+1,false));

@BAILOOL
Copy link
Owner

BAILOOL commented Apr 15, 2019

@drondao Thank you for pointing it out. Feel free to commit changes through the pull request.

@BAILOOL BAILOOL closed this as completed Apr 16, 2019
@BAILOOL BAILOOL linked a pull request Jan 26, 2022 that will close this issue
@BAILOOL BAILOOL added the bug label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants