-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetEntitiesRecursive method stack overflow possible? #11
Comments
Yes, a stack overflow exception is possible at the moment. I'm not sure how deep the directory structure will get to hit that limitation though. It might not be a problem in practice, but it is possible to create a directory structure of infinite depth. That would certainly hit the limit. Making it iterative would not help in those cases. Best solution would be to add a maximum depth parameter to |
This can be easily rewritten using a
This ensures that there is no recursion and significantly reduces memory usage as there is only one instance of the enumerator class created no matter how deep you go. The only issue is that it reverses the order of enumeration of folders at each level. This can be resolved by sorting the entity list from
|
It looks like one of the methods, GetEntitiesRecursive, uses recursion, which could potentially cause a stack overflow. Maybe it should be turned into an iterative method?
The text was updated successfully, but these errors were encountered: