Skip to content

Commit

Permalink
bugfix: resolved windows seg fault
Browse files Browse the repository at this point in the history
  • Loading branch information
mshafiei committed Jun 7, 2018
1 parent 049600a commit f5733f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/fbow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void Vocabulary::setParams(int aligment, int k, int desc_type, int desc_size, in
//give memory
_params._total_size=_params._block_size_bytes_wp*_params._nblocks;
#if _WIN32
_data = (char*)_aligned_malloc(_params._aligment, _params._total_size);
_data = (char*)_aligned_malloc(_params._total_size, _params._aligment);
#else
_data=(char*)aligned_alloc(_params._aligment,_params._total_size);
#endif
Expand Down Expand Up @@ -153,7 +153,7 @@ void Vocabulary::fromStream(std::istream &str)throw(std::exception)
str.read((char*)&_params,sizeof(params));

#if _WIN32
_data = (char*)_aligned_malloc(_params._aligment, _params._total_size);
_data = (char*)_aligned_malloc(_params._total_size, _params._aligment);
#else
_data = (char*)aligned_alloc(_params._aligment, _params._total_size);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/fbow.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class FBOW_API Vocabulary
_nwords=_block_desc_size_bytes_wp/sizeof(register_type );//number of aligned words

#if _WIN32
feature = (register_type*)_aligned_malloc(aligment, _nwords * sizeof(register_type));
feature = (register_type*)_aligned_malloc(_nwords * sizeof(register_type), aligment);
#else
feature = (register_type*)aligned_alloc(aligment, _nwords * sizeof(register_type));
#endif
Expand Down

2 comments on commit f5733f5

@rmsalinas
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it must have been hard to get to that conclusion :O

@rmsalinas
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u please pass me the data that caused the seg fault so I can try to reproduce the error in my computer. I have an updated version of the library that has not been uploaded yet and I want to make sure the error does not persists before I release it.

Please sign in to comment.