In java, an object has overhead of 16 bytes as a minimum
size before you consider what other content it holds.
1e8 items in a hash map has an underestimated size requirement
of 1e8 * 2 * 16 Bytes, and that is assuming your keys and
values are Numbers so that requires a few GB of heap available
in your heap and from your computer.
A string is an object holding a character array so your strings
as mentioned by many above may be larger than a Double object
for example, hence you would need more memory available to the
heap.
Note that programs begin to perform poorly when you near the limit
of your computer too.
If you are not wanting to use a database as suggested above,
you could consider encoding and compressing your keys to make
them into numbers that you can still count the frequency of.
You could choose an entropy based encoding based upon the
frequency of words in that first encoding and go from there...