Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.
/ gandiva Public archive

Fix destructor and add include_directories #44

Closed
wants to merge 1 commit into from
Closed

Fix destructor and add include_directories #44

wants to merge 1 commit into from

Conversation

cpcloud
Copy link

@cpcloud cpcloud commented Jun 22, 2018

This PR fixes a memory leak where destruction of pointers to Nodes that are
instances of child classes are not called because Node's destructor is not
virtual.

@@ -18,6 +18,7 @@ find_library(ARROW_LIB arrow REQUIRED)
message(STATUS "Found arrow library at ${ARROW_LIB}")

find_path(ARROW_INCLUDE_DIR arrow/type.h)
include_directories("${ARROW_INCLUDE_DIR}")
Copy link
Contributor

Choose a reason for hiding this comment

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

we are following the recommendations for modern/modular cmake, which says that all include_directories must be against a target only (within the project), and prefers taking dependency on targets (for external projects) instead of explicitly adding include-dirs/compile-flags/libs/..

https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1#forget-the-commands-add_compiler_options-include_directories-link_directories-link_libraries

What's the reason for this change ? Maybe, I could suggest alternatives.

Copy link
Author

Choose a reason for hiding this comment

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

Interesting. I added this because cmake was unable to find arrow includes without it.

Copy link
Contributor

Choose a reason for hiding this comment

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

is this a problem while building gandiva ? Or, a project/test that depends on gandiva ? If it's the latter, you could use the procedure we do for our integration tests.

target_link_libraries(${TEST_NAME} PRIVATE gandiva)

Copy link
Author

Choose a reason for hiding this comment

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

This is a problem when building gandiva. I have arrow installed in a conda environment. I can provide additional steps to reproduce if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry for the delay, I was on vacation. Can you please provide the steps to reproduce ?

Also, can you please spin off a different PR for the memleak fix ?

Copy link
Author

Choose a reason for hiding this comment

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

Yep. I should be able to get to this tonight.

@@ -34,6 +34,8 @@ class Node {
explicit Node(DataTypePtr return_type)
: return_type_(return_type) { }

virtual ~Node() = default;
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for fixing this !

@wesm
Copy link

wesm commented Sep 29, 2018

These issues are resolved in apache/arrow#2558

@pravindra pravindra closed this Oct 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants