> 
> Integrability of $f$ on $\mathbb{R}$ does not necessarily imply the convergence of $f(x)$ to $0$ as $x \to \infty$.
> 
> 
> (a) There exists a *positive* continuous function $f$ on $\mathbb{R}$ so that $f$ is integrable on $\mathbb{R}$, but yet $\operatorname{lim sup}\_{x \to \infty} f(x)=\infty$
> 
> 
> [Hint: For (a), construct a continuous version of the function equal to $n$ on the segment $[n,n+\frac 1{n^3})$, $n \ge 1$.]
> 
> 
> 

Stein-Shakarchi: Chapter 2, Exercise 6(a)

Following the textbook's hint, I tried to define $$f(x)=\begin{cases}\frac {n^3}{x^2} & \text{if } x \in(-\infty,n) \\ n & \text{if }x \in [n,n+\frac 1{n^3}) \\ \frac{n(n+\frac 1{n^3})^2}{x^2} & \text{if } x \in (\frac 1{n^3},\infty),\end{cases}$$

so that $f$ is continuous, positive, and $\int\_\mathbb{R} f(x) \, dx < \infty$. Will this make a good example? I do not know if $\operatorname{lim sup}\_{x \to \infty} f(x)=\infty$.