The question is about how to use hyperscan database.
I have compile some original databases, and next I want reconstruct them on different memory locations (say, NUMA nodes). To save time of compiling patterns, I just follow steps as below:
- compile original databases A, B, and get their size NA, NB (by hs_database_size)
- allocate enough memory (>=(NA+NB)) at new memory locations; the start addresses are A¡¯£¬B'
- memcpy A to A¡¯, and B to B¡¯
- allocate scratch for A¡¯ and B¡¯
These steps go well, but I have some problems when calling hs_scan:
- when link to debug-compiled hyperscan library, an assertion fails (a value is not 64 bits aligned)
- I compile 4 databases and 3 of them work well, but one raises segment fault
After long time debugging, I think maybe I shouldn¡¯t memcpy database simply like above.
Do I have to call hs_serialize_XXX to serialize original databases and then deserialize them on new memory locations?
Thanks for your reply,