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

Win32: Drastically reduce stack usage at startup. NFC? #533

Merged
merged 1 commit into from Feb 24, 2020

Conversation

ruevs
Copy link
Member

@ruevs ruevs commented Dec 20, 2019

See:
#92 (comment)

The problem was first introduced here:
dabd578

and later "fixed" here:
f324477
by setting the stack size to /STACK:33554432

Solvespace now starts up even with /STACK:554432

According to this:
https://en.cppreference.com/w/cpp/language/value_initialization

"2) if T is a class type with a default constructor that is neither user-provided nor deleted (that is, it may be a class with an implicitly-defined or defaulted default constructor), the object is zero-initialized and then it is default-initialized if it has a non-trivial default constructor; "

So removing the {} should leave both the System and TextWindow class instances properly initialized.

@whitequark
Copy link
Contributor

whitequark commented Dec 20, 2019

The only question now is whether omitting the {} in TextWindow and System constructor calls in the initializer list of the SolveSpaceUI constructor has any adverse effect.

Default-initialization and list-aggregate-initialization are different. On a cursory check, System is POD, so default-initializing it would leave garbage inside. TextWindow is not, so it should be benign there. However, VS12 that we use for Appveyor builds could have bugs beyond this, so you should check that the CI-built binary works.

@ruevs
Copy link
Member Author

ruevs commented Dec 20, 2019

The appveyor artifact runs on my Win10 64 machine, so does my locally compiled copy... but that does not mean much.

@ruevs ruevs force-pushed the master branch 2 times, most recently from 4188cdf to 56f139d Compare December 23, 2019 20:16
See:
solvespace#92 (comment)

The problem was first introduced here:
solvespace@dabd578

and later "fixed" here:
solvespace@f324477
by setting the stack size to /STACK:33554432

Solvespace now starts up even with /STACK:554432

According to this:
https://en.cppreference.com/w/cpp/language/value_initialization
```
"2) if T is a class type with a default constructor that is neither user-provided nor deleted (that is, it may be a class with an implicitly-defined or defaulted default constructor), the object is zero-initialized and then it is default-initialized if it has a non-trivial default constructor; "
```
So removing the `{}` should leave both the `System` and `TextWindow` class instances properly initialized.
@ruevs
Copy link
Member Author

ruevs commented Feb 20, 2020

Merge? ;-)

@whitequark whitequark merged commit fcb2757 into solvespace:master Feb 24, 2020
@whitequark
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants