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

Compiler is out of heap space when registering large amount of functions #329

Closed
SnailAfterRain opened this issue Feb 2, 2017 · 3 comments
Closed
Assignees
Labels
Milestone

Comments

@SnailAfterRain
Copy link

@SnailAfterRain SnailAfterRain commented Feb 2, 2017

I have about 5000 functions that i have to expose to lua, basically i wrote a generator to do that for me like that:

lua.set_function("func", func);
...

When im trying to compile it it takes 4gb of memory and then it fails with

I tried splitting functions to separate .cpp files 500 in each and then it works, but is there other solution to that?

@OrfeasZ
Copy link
Contributor

@OrfeasZ OrfeasZ commented Feb 2, 2017

I have a similar issue, but I've worked around it by using the x64 toolset (this doesn't mean compiling an x64 binary, it just means that the compiler itself is the 64-bit version). This allows the compiler and linker to utilize more than 4GB of RAM.

There's multiple ways to use the x64 MSVC toolset, but the method I'm using is just setting the PreferredToolArchitecture environment variable value to x64.

You could also add the following under the <Import .../> statement in your .vcxproj file to use the x64 toolset only on a specific project:

<PropertyGroup>
    <PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>

Edit: I should also note that you should clean your solution after switching toolsets.

@SnailAfterRain
Copy link
Author

@SnailAfterRain SnailAfterRain commented Feb 2, 2017

@OrfeasZ Now it takes 8gb but actually compiles. Thank you!

@OrfeasZ
Copy link
Contributor

@OrfeasZ OrfeasZ commented Feb 2, 2017

@cafebabe0 Glad to be able to help :)

@ThePhD ThePhD self-assigned this Feb 2, 2017
@ThePhD ThePhD added the Help.Desk label Feb 2, 2017
@ThePhD ThePhD added this to the Helpdesk milestone Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants