If $\int_0^\infty f\text{d}x$ exists, does $\lim_{x\to\infty}f(x)=0$? Are there examples of functions $f$ such that $\int_0^\infty f\text{d}x$ exists, but $\lim_{x\to\infty}f(x)\neq 0$?

I curious because I know for infinite series, if $a_n\not\to 0$, then $\sum a_n$ diverges. I'm wondering if there is something similar for improper integrals.
It depends on what $\int$ means and what else you know about $f$.
Here is a continuous example with limits of Riemann integrals:

Let $h(x)=\max\{1-|x|,0\}$ and set $f(x)=\sum_{n=1}^\infty (-1)^n h(nx-n^2)$.
This function has up and down "bumps" around integers that become smaller and smaller in area, but have fixed height.
If $\lim_{x\to+\infty}f(x)=l&gt;0$, then $\exists M&gt;0:l-\varepsilon&lt;f(x)&lt;l+\varepsilon\quad \forall x&gt;M$, and so

$$
\int_M^{+\infty}f(x)dx&gt;\int_M^{+\infty}(l-\varepsilon)dx=+\infty
$$

if $\varepsilon$ is sufficiently small.