# Memory usage in recursive function as infinite loop

**URL:** <https://discuss.ocaml.org/t/memory-usage-in-recursive-function-as-infinite-loop/4320>\
**Category:** Learning\
**Tags:** recursion\
**Created:** [September 6, 2019, 1:08pm UTC](https://discuss.ocaml.org/t/memory-usage-in-recursive-function-as-infinite-loop/4320 "2019-09-06T13:08:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![diegogub](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/diegogub/32/5965_2.png) [@diegogub](https://discuss.ocaml.org/u/diegogub)\
**Post date:** [September 6, 2019, 1:08pm UTC](https://discuss.ocaml.org/t/memory-usage-in-recursive-function-as-infinite-loop/4320/1 "2019-09-06T13:08:47Z")

</div>

Hello,

On my project I have a process that has to run every 1 sec, fetching events and doing some work with them.

Should I use. a while true loop or recursive function? How does it affect memory usage?

Thanks

---

_[View the full topic](https://discuss.ocaml.org/t/memory-usage-in-recursive-function-as-infinite-loop/4320)._
