Skip to content
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

Support for $MaximumFunctionCount and other limits should be removed #2221

Closed
lzybkr opened this issue Sep 9, 2016 · 3 comments · Fixed by #2363
Closed

Support for $MaximumFunctionCount and other limits should be removed #2221

lzybkr opened this issue Sep 9, 2016 · 3 comments · Fixed by #2363
Assignees
Labels
Issue-Bug Issue has been identified as a bug in the product WG-Engine core PowerShell engine, interpreter, and runtime WG-Language parser, language semantics

Comments

@lzybkr
Copy link
Member

lzybkr commented Sep 9, 2016

We should consider removing the following variables:

PS> gv Max*Count

Name                           Value
----                           -----
MaximumAliasCount              4096
MaximumDriveCount              4096
MaximumErrorCount              256
MaximumFunctionCount           4096
MaximumHistoryCount            4096
MaximumVariableCount           4096

They don't really protect the user from anything (it's easy to use up memory in many other ways) and they block some valid uses, e.g. if you add > 4096 functions in InitialSessionState, the extra functions will be silently ignored - and there is no good way to increase that limit until after the runspace is open.

@lzybkr lzybkr added Issue-Bug Issue has been identified as a bug in the product WG-Engine core PowerShell engine, interpreter, and runtime WG-Language parser, language semantics labels Sep 9, 2016
@lzybkr lzybkr self-assigned this Sep 9, 2016
@lzybkr lzybkr added 2 - Ready and removed 2 - Ready labels Sep 9, 2016
@rkeithhill
Copy link
Collaborator

Agreed. I'd much rather see a consolidated "reporting" command that tells me how many of each I have (even better if it could display memory foot print). In case I need to debug a situation where too much memory is used for/by something. But even without that, yeah I'd be fine with removing these.

@nightroman
Copy link

nightroman commented Sep 11, 2016

It's a very good idea.

I have some doubts about removing MaximumErrorCount. It is very different
from the others and some limit makes sense. There may be a lot of errors in
some cases. This is bad for long running processes. Developers must keep
in mind that memory may leak via errors and care of this. Why?

Besides, when errors really have to be collected and analysed then use of
-ErrorVariable parameter for a particular command is better than use of
$Error which also may contain noise errors. -ErrorVariable is unlimited.

@rkeithhill
Copy link
Collaborator

rkeithhill commented Sep 11, 2016

Removing the max value variable doesn't mean the error collection couldn't still be capped at a max size of 256. I guess the question in this case is - does anybody ever change (increase) that value? I can't say that I have ever done that in 10+ years of using PowerShell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Issue has been identified as a bug in the product WG-Engine core PowerShell engine, interpreter, and runtime WG-Language parser, language semantics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants