I have noticed for years many variations of punctuation when you combine numbers and capacity abbreviations. I read a lot of technical stuff and I do not and I can not find (searching the web) a reference to the correct usage.
Which is correct?

4GB RAM, no space between 4 and G
4 GB RAM, space between 4 and G
4-GB RAM, hyphen between 4 and G

Is there a hard and fast rule?

Now with MHz it seems to be consistent, there is always a space between the number and the MHz. Why?
I doubt you will find a rule laid out for such a volatile field of vocabulary, but traditional punctuation would call for 4-GB RAM, an adjective-noun formation on the model of 12-pound hammer.

Similarly, a careful computer-grammarian would hyphenate: 700-MHz spectrum.
Teachers: We supply a list of EFL job vacancies
Thank you. I continued to research the issue and came across similar results. From what I think I understand the "4" and "GB" represent a compound modifier for "RAM" and generally require the hyphen. As for why I have seen MHz or GHz without a hyphen so often is it generally has been used in relation to processors, which generally are discussed as, Intel Xeon E5430 Processor (2.66 GHz, 1333 FSB) with a quad-core. The frequency is not used as a compound modifier. If is was used as, 2.66 GHz Intel Xeon E5430 Processor, then I think the hyphen would be required.

Is that correct reasoning?