-
Notifications
You must be signed in to change notification settings - Fork 384
Fix #3237: Configure default GC settings at compile time #4338
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
Conversation
Some test results for gc none. Note that compiled in settings can be overridden by env vars for a nice extra. Note: the default is % ./sandbox/.2.13/target/scala-2.13/sandbox
GC_THREAD_HEAP_BLOCK_SIZE=32m
Hello, World!
% export GC_THREAD_HEAP_BLOCK_SIZE=128m
% ./sandbox/.2.13/target/scala-2.13/sandbox
GC_THREAD_HEAP_BLOCK_SIZE=128m
Hello, World! |
Test for immix: % ./sandbox/.2.13/target/scala-2.13/sandbox
GC_INITIAL_HEAP_SIZE=5m
GC_MAXIMUM_HEAP_SIZE=5m
Hello, World!
% export GC_INITIAL_HEAP_SIZE=10m
% export GC_MAXIMUM_HEAP_SIZE=20m
% ./sandbox/.2.13/target/scala-2.13/sandbox
GC_INITIAL_HEAP_SIZE=10m
GC_MAXIMUM_HEAP_SIZE=20m
Hello, World! |
Memory values can be debugged via |
Looks like |
Co-authored-by: Wojciech Mazur <wojciech.mazur95@gmail.com>
Ok, I have no idea what is wrong with the formatting. |
Ok, confirmed it still work with env override. |
Set out to complete the requested review. Because of discussions in this topic, I had expected the build failure to be about code formatting, |
Adding visibility of the internal values is a good step. I am a big fan Now, which namespace is a somewhat harder issue; the dead hand of It would be nice if it were somewhat like "SCALANATIVE_GC_DEBUG_PRINT". A lesser, IMO, possibility would be "GC_DEBUG_PRINT". I do not |
About the DEBUG_PRINT suggestion, I used the existing one being used. The idea to align with Boehm with the shared I already got myself into more because of this - ivmai/bdwgc#735 |
Still working on review...
I understand & appreciate not wanting to break the world. SN is not 1.0 yet, We both have many demands on our time, especially on a long holiday weekend, so I Perhaps you/we could keep the existing DEBUG_PRINTF in the code but Do you know who added and when the existing idiom was added? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good To Me - LGTM. Thank you.
A discussion of C style, getting this puppy shipped as-is is much more important in my mind. Different authors will do things different ways. One of the things I like about Scala Native There is a block is correct but I think might be simplified. Of course, one person's simplification
Perhaps I've been reading & writing too much Scala recently, but the "if defined()"s somehow A voice is telling me that GC_* should always be defined. That is, at the top of the file
Then one could remove the '#if defined()' lines (and corresponding #endif) and Eric, you know the problem domain. Is there a better sensible for each of the three, across GCs?
Will give you the NULL return that happens now. That keeps a lot of the C macro When I am on my long walk, I'll let my remaining disquiet of the 3 strcmp()s percolate. Thanks for listening/reading. |
Lee, on the last comment we need to check which ENV var is being asked for at runtime. It just returns the defined value if there it one. I hope that makes sense because if you follow the call chain, at runtime the parsing of the memory value still occurs even if it is compiled in. Edit: I only answered part of your question. The user can decide to only set the MIN or the MAX memory or both and the default case is none are defined so the whole |
@WojciechMazur I think this is ready to go now. |
@LeeTibbert I added a ticket about the debug - #4350 |
The only thing really to note is that for Boehm you need to define with memory in bytes. I couldn't really verify that the setting worked as it doesn't seem to really allocate the initial heap right away but looking at the code it seems to be ok. Plus, if I try to set
3m
or something, the build fails because the#define
passed on the command line needs to be anint
. Our memory parser also just passes back the bytes if passed to it so you can set the other GCs with bytes.Note: in the
clang-format
it seems if you have a defined function with an empty body eitherfun{};
orfun {}
are ok. you don't really need a semi-colon on the first one so the second one makes more sense.