Hey, you could consider using a different associative data structure which does not store all the substrings. For example Prefix Trees / Tries could reduce the space overhead. However, I dont know if there already exists an efficient implementation for your purpose, but you can look into Tries.jl or the trie implementation from DataStrucutures.jl.
You could alternatively redesign your program so that it doesnt require the entire search space in memory at once but can lazily compute it when needed.