I'll start off by saying, "Fish cannot inhibit their growth to conform to a grossly undersized habitat, e.g. A Oscar in a 10gal tank."
Fish will attempt to grow according to a set of variables, they may grow fast or slow, but they will grow and attempt to reach their genetically programmed average adult size. Certain conditions in both captivity and nature may make this impossible and result in stunting/death.
Sploke, your absolutely correct.
There is direct correlation between size and food, temp/seasonal environmental changes, in-direct/direct competition and habitat size/quality.
This can result in short-term and long-term adaptability in a particular species and is a variable from generation to generation.
Another thing to consider is the difference between average and maximum size potential, not all will attain maximum and will fall somewhere within the average. Many species profiles from various sources often state the size like this, 'To 40" in nature; not usually more than 18" in captivity.'
Why is this? Because size of habitat does play a role in growth rate and average size, if you are capable of providing adequate food and a ideal habitat equal to one in nature you are likely to raise a larger specimen if the genetics allow.
In captivity if we supply the basic needs; clean water/proper temp, abundant/nutritious diet and a habitat of sufficient size (minimum recommended,e.g. 55gal for a Oscar) then the fish will grow to atleast it's average species size. Perhaps not it's maximum, but a healthy adult none the less.
Anything less is asking for trouble.