I am glad you found the solution.
Some plugins and themes do call this function at every page load. It is very bad practice as:
1. it is likely to break something if the call is made very soon in process (it will break Polylang if it is called before the 'wp_loaded' is fired).
2. it is a very expensive function and thus should be used as less as possible.