Well at first sight, its not the categories...
but that doesnt mean anything..
functions.php line 6875 is a hook called global complete
. There, gallery does only one thing: it sets the users location for "badlocation" if a page is no known by the system. (used in who is online and profile) thats only 4 lines. That hardly takes any memory. So as you have at least 105 lines on that hook, it must be an other plugin at that location.
It could of course be, that your memory is so full that a teeny weeny bit will be the straw that breaks the camels back..
But I doubt it: as a matter of fact, I do not understand why setting the category depth differently would change anything there... (it must be something else, and changing the cat depth would trigger that "something else)
Because, ALL your categories, names, ids, options, etc,, are saved in datastore cache.
They are only fetched from there in a plugin, way before that hook.
It is one serialized array.
And They are ALL fetched, in one array, no matter what depth you have for display.
It could of course interfere on gallery index page, if you have a lot of cats to render, but only on index page and memory should not be exhausted on the location it is exhausted.
What I suspect, is that you might have another hack using the global_complete hook, doing lots of stuff. (adding that to vbgallery might use to much memory)
Check your plugin manager. search for hook global_complete. (in other products than vbgallery)
you could disable those if they are not needed in vbgallery by making them optional.
Content visible to verified customers only.
thats just an idea..
PS: How many cats do you have?