Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Fixed excessive memory consumption #38

Merged
merged 1 commit into from
Dec 21, 2017
Merged

Fixed excessive memory consumption #38

merged 1 commit into from
Dec 21, 2017

Conversation

noseglasses
Copy link
Collaborator

Nested calls to make_arduino_library cause an exponential groth of the LIB_INCLUDES variable. This PR fixes it.

@@ -48,11 +48,11 @@ function(make_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLAG
endforeach ()

if (LIB_INCLUDES)
string(REPLACE ";" " " LIB_INCLUDES "${LIB_INCLUDES}")
string(REPLACE ";" " " LIB_INCLUDES_SPACE_SEPARATED "${LIB_INCLUDES}")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the compiler command line generated with set_target_properties below requires a space separated version of LIB_INCLUDES.
If we replace the ; in the cmake list LIB_INCLUDES, the list(REMOVE_DUPLICATES LIB_INCLUDES) call at the end of the function does not remove anything.

@fraillt
Copy link

fraillt commented Dec 20, 2017

@noseglasses
Could you please check my PR #35 and see if this issue exists?

@noseglasses
Copy link
Collaborator Author

@fraillt

Could you please check my PR #35 and see if this issue exists?

I had a brief glance at PR #35 but it is a monster. I can't tell for sure it the memory explosion persists. This is probably way easier for you to find out.

@fraillt
Copy link

fraillt commented Dec 20, 2017

I can check this, but not sure how to do it? :)
What project should I use, what properties should I watch for, etc...

@noseglasses
Copy link
Collaborator Author

This PR changes two lines. If you did not change the respective lines or just moved them elsewhere, the problem will persist. As you apparently did not run into the problems I encountered (computer stalling because of memory exhaustion), you probably did not touch the respective lines.

@fraillt
Copy link

fraillt commented Dec 20, 2017

It is hard to tell whether I changed it or not because I refactored a lot of things, added and removed something in the process. So it is hard for me to tell if I fixed this problem or not because I never encountered theses issues in the first place :) so that's why I'm asking to check my branch if you encounter this problem, you'll see if it's gone or not.

@noseglasses
Copy link
Collaborator Author

I can now confirm that PR #35 fixes this issue. This PR can be closed in case PR #35 has been merged prior to it.

Copy link
Member

@MrPointer MrPointer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good and simple, thank you.
Until @fraillt manages to organize his PRs better, I'm merging this one to fix the bug at least temporarily.

@MrPointer MrPointer merged commit e377f9c into arduino-cmake:master Dec 21, 2017
@noseglasses noseglasses deleted the ng_pr_memory_explosion branch January 5, 2018 18:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants