In my opinion it is trivial that if an algorithm is polynomial time in its input length then it is also polynomial space. Is this true and really trivial or do I overlook something? If it is wrong, what counterexamples do we have?
(I know that for decision problems we have $PTIME \subseteq PSPACE$. But I am not sure if this also holds for algorithms of other problems like computing a function, arithmetic operations, etc.)