to avoid dangerous memory leak, modified many structs and codes.(\!)
complete arrFindSegments