You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2018/12/08 01:38:18 UTC

[arrow] branch master updated: ARROW-3955: [GLib] Add (transfer full) to free when no longer needed

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 80989ef  ARROW-3955: [GLib] Add (transfer full) to free when no longer needed
80989ef is described below

commit 80989ef777165e04a8edff7ee7b089fec920bb1e
Author: Yosuke Shiro <yo...@gmail.com>
AuthorDate: Sat Dec 8 10:38:03 2018 +0900

    ARROW-3955: [GLib] Add (transfer full) to free when no longer needed
    
    Author: Yosuke Shiro <yo...@gmail.com>
    
    Closes #3122 from shiro615/glib-fix-memory-leak and squashes the following commits:
    
    0a60f20a <Yosuke Shiro> Add missing Ruby/GObjectIntrospection version check
    6b0f7ee2 <Yosuke Shiro>  Add (transfer full) to free when no longer needed
---
 c_glib/arrow-glib/basic-array.cpp        | 12 +++++++-----
 c_glib/arrow-glib/basic-data-type.cpp    |  4 ++--
 c_glib/arrow-glib/chunked-array.cpp      |  3 ++-
 c_glib/arrow-glib/column.cpp             |  3 ++-
 c_glib/arrow-glib/decimal.cpp            |  8 ++++----
 c_glib/arrow-glib/reader.cpp             |  7 +++++--
 c_glib/arrow-glib/record-batch.cpp       |  3 ++-
 c_glib/arrow-glib/table.cpp              |  3 ++-
 c_glib/arrow-glib/tensor.cpp             |  8 ++++++--
 c_glib/gandiva-glib/expression.cpp       |  3 ++-
 c_glib/plasma-glib/object.cpp            |  2 +-
 c_glib/test/test-boolean-array.rb        |  2 +-
 c_glib/test/test-record-batch-builder.rb |  2 ++
 c_glib/test/test-tensor.rb               |  4 ++--
 14 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/c_glib/arrow-glib/basic-array.cpp b/c_glib/arrow-glib/basic-array.cpp
index 47f9a95..fef43a0 100644
--- a/c_glib/arrow-glib/basic-array.cpp
+++ b/c_glib/arrow-glib/basic-array.cpp
@@ -496,7 +496,8 @@ garrow_array_slice(GArrowArray *array,
  * @array: A #GArrowArray.
  * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable): The formatted array content or %NULL on error.
+ * Returns: (nullable) (transfer full):
+ *   The formatted array content or %NULL on error.
  *
  *   The returned string should be freed when with g_free() when no
  *   longer needed.
@@ -766,7 +767,8 @@ garrow_boolean_array_get_value(GArrowBooleanArray *array,
  * @array: A #GArrowBooleanArray.
  * @length: (out): The number of values.
  *
- * Returns: (array length=length): The raw boolean values.
+ * Returns: (array length=length) (transfer full):
+ *   The raw boolean values.
  *
  *   It should be freed with g_free() when no longer needed.
  */
@@ -2146,10 +2148,10 @@ garrow_decimal128_array_class_init(GArrowDecimal128ArrayClass *klass)
  * @array: A #GArrowDecimal128Array.
  * @i: The index of the target value.
  *
- * Returns: The formatted i-th value.
+ * Returns: (transfer full): The formatted i-th value.
  *
- * The returned string should be freed with g_free() when no longer
- * needed.
+ *   The returned string should be freed with g_free() when no longer
+ *   needed.
  *
  * Since: 0.10.0
  */
diff --git a/c_glib/arrow-glib/basic-data-type.cpp b/c_glib/arrow-glib/basic-data-type.cpp
index 86b86cf..cd3aa97 100644
--- a/c_glib/arrow-glib/basic-data-type.cpp
+++ b/c_glib/arrow-glib/basic-data-type.cpp
@@ -198,8 +198,8 @@ garrow_data_type_equal(GArrowDataType *data_type,
  * garrow_data_type_to_string:
  * @data_type: A #GArrowDataType.
  *
- * Returns: The string representation of the data type. The caller
- *   must free it by g_free() when the caller doesn't need it anymore.
+ * Returns: (transfer full): The string representation of the data type.
+ *   The caller must free it by g_free() when the caller doesn't need it anymore.
  */
 gchar *
 garrow_data_type_to_string(GArrowDataType *data_type)
diff --git a/c_glib/arrow-glib/chunked-array.cpp b/c_glib/arrow-glib/chunked-array.cpp
index e046b0d..6d9598b 100644
--- a/c_glib/arrow-glib/chunked-array.cpp
+++ b/c_glib/arrow-glib/chunked-array.cpp
@@ -302,7 +302,8 @@ garrow_chunked_array_slice(GArrowChunkedArray *chunked_array,
  * @chunked_array: A #GArrowChunkedArray.
  * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable): The formatted chunked array content or %NULL on error.
+ * Returns: (nullable) (transfer full):
+ *   The formatted chunked array content or %NULL on error.
  *
  *   The returned string should be freed when with g_free() when no
  *   longer needed.
diff --git a/c_glib/arrow-glib/column.cpp b/c_glib/arrow-glib/column.cpp
index 06ab0b7..e3e964f 100644
--- a/c_glib/arrow-glib/column.cpp
+++ b/c_glib/arrow-glib/column.cpp
@@ -372,7 +372,8 @@ garrow_column_get_data(GArrowColumn *column)
  * @column: A #GArrowColumn.
  * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable): The formatted column content or %NULL on error.
+ * Returns: (nullable) (transfer full):
+ *   The formatted column content or %NULL on error.
  *
  *   The returned string should be freed when with g_free() when no
  *   longer needed.
diff --git a/c_glib/arrow-glib/decimal.cpp b/c_glib/arrow-glib/decimal.cpp
index 67b2d43..34eb417 100644
--- a/c_glib/arrow-glib/decimal.cpp
+++ b/c_glib/arrow-glib/decimal.cpp
@@ -141,9 +141,9 @@ garrow_decimal128_new_integer(const gint64 data)
  * @decimal: A #GArrowDecimal128.
  * @scale: The scale of the decimal.
  *
- * Returns: The string representation of the decimal.
+ * Returns: (transfer full): The string representation of the decimal.
  *
- * It should be freed with g_free() when no longer needed.
+ *   It should be freed with g_free() when no longer needed.
  *
  * Since: 0.10.0
  */
@@ -159,9 +159,9 @@ garrow_decimal128_to_string_scale(GArrowDecimal128 *decimal, gint32 scale)
  * garrow_decimal128_to_string:
  * @decimal: A #GArrowDecimal128.
  *
- * Returns: The string representation of the decimal.
+ * Returns: (transfer full): The string representation of the decimal.
  *
- * It should be freed with g_free() when no longer needed.
+ *   It should be freed with g_free() when no longer needed.
  *
  * Since: 0.10.0
  */
diff --git a/c_glib/arrow-glib/reader.cpp b/c_glib/arrow-glib/reader.cpp
index c6c9667..b4afde3 100644
--- a/c_glib/arrow-glib/reader.cpp
+++ b/c_glib/arrow-glib/reader.cpp
@@ -645,9 +645,11 @@ garrow_feather_file_reader_new(GArrowSeekableInputStream *file,
  * garrow_feather_file_reader_get_description:
  * @reader: A #GArrowFeatherFileReader.
  *
- * Returns: (nullable): The description of the file if it exists,
+ * Returns: (nullable) (transfer full):
+ *   The description of the file if it exists,
  *   %NULL otherwise. You can confirm whether description exists or not by
  *   garrow_feather_file_reader_has_description().
+ *
  *   It should be freed with g_free() when no longer needed.
  *
  * Since: 0.4.0
@@ -730,7 +732,8 @@ garrow_feather_file_reader_get_n_columns(GArrowFeatherFileReader *reader)
  * @reader: A #GArrowFeatherFileReader.
  * @i: The index of the target column.
  *
- * Returns: The i-th column name in the file.
+ * Returns: (transfer full): The i-th column name in the file.
+ *
  *   It should be freed with g_free() when no longer needed.
  *
  * Since: 0.4.0
diff --git a/c_glib/arrow-glib/record-batch.cpp b/c_glib/arrow-glib/record-batch.cpp
index f905b06..04d442b 100644
--- a/c_glib/arrow-glib/record-batch.cpp
+++ b/c_glib/arrow-glib/record-batch.cpp
@@ -331,7 +331,8 @@ garrow_record_batch_slice(GArrowRecordBatch *record_batch,
  * @record_batch: A #GArrowRecordBatch.
  * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable): The formatted record batch content or %NULL on error.
+ * Returns: (nullable) (transfer full):
+ *   The formatted record batch content or %NULL on error.
  *
  *   The returned string should be freed when with g_free() when no
  *   longer needed.
diff --git a/c_glib/arrow-glib/table.cpp b/c_glib/arrow-glib/table.cpp
index b4d0d2c..f9e1b95 100644
--- a/c_glib/arrow-glib/table.cpp
+++ b/c_glib/arrow-glib/table.cpp
@@ -313,7 +313,8 @@ garrow_table_replace_column(GArrowTable *table,
  * @table: A #GArrowTable.
  * @error: (nullable): Return location for a #GError or %NULL.
  *
- * Returns: (nullable): The formatted table content or %NULL on error.
+ * Returns: (nullable) (transfer full):
+ *   The formatted table content or %NULL on error.
  *
  *   The returned string should be freed when with g_free() when no
  *   longer needed.
diff --git a/c_glib/arrow-glib/tensor.cpp b/c_glib/arrow-glib/tensor.cpp
index ff2683d..46ae7be 100644
--- a/c_glib/arrow-glib/tensor.cpp
+++ b/c_glib/arrow-glib/tensor.cpp
@@ -281,7 +281,9 @@ garrow_tensor_get_buffer(GArrowTensor *tensor)
  * @tensor: A #GArrowTensor.
  * @n_dimensions: (out): The number of dimensions.
  *
- * Returns: (array length=n_dimensions): The shape of the tensor.
+ * Returns: (array length=n_dimensions) (transfer full):
+ *   The shape of the tensor.
+ *
  *   It should be freed with g_free() when no longer needed.
  *
  * Since: 0.3.0
@@ -306,7 +308,9 @@ garrow_tensor_get_shape(GArrowTensor *tensor, gint *n_dimensions)
  * @tensor: A #GArrowTensor.
  * @n_strides: (out): The number of strides.
  *
- * Returns: (array length=n_strides): The strides of the tensor.
+ * Returns: (array length=n_strides) (transfer full):
+ *   The strides of the tensor.
+ *
  *   It should be freed with g_free() when no longer needed.
  *
  * Since: 0.3.0
diff --git a/c_glib/gandiva-glib/expression.cpp b/c_glib/gandiva-glib/expression.cpp
index 529d851..b4e7a96 100644
--- a/c_glib/gandiva-glib/expression.cpp
+++ b/c_glib/gandiva-glib/expression.cpp
@@ -201,7 +201,8 @@ ggandiva_expression_new(GGandivaNode *root_node,
  * ggandiva_expression_to_string:
  * @expression: A #GGandivaExpression.
  *
- * Returns: The string representation of the node in the expression tree.
+ * Returns: (transfer full): The string representation of the node in the expression tree.
+ *
  *   It should be freed with g_free() when no longer needed.
  *
  * Since: 0.12.0
diff --git a/c_glib/plasma-glib/object.cpp b/c_glib/plasma-glib/object.cpp
index 63dc209..f7afd72 100644
--- a/c_glib/plasma-glib/object.cpp
+++ b/c_glib/plasma-glib/object.cpp
@@ -131,7 +131,7 @@ gplasma_object_id_to_binary(GPlasmaObjectID *id,
  * gplasma_object_id_to_hex:
  * @id: A #GPlasmaObjectID.
  *
- * Returns: The hex representation of the object ID.
+ * Returns: (transfer full): The hex representation of the object ID.
  *
  *   It should be freed with g_free() when no longer needed.
  *
diff --git a/c_glib/test/test-boolean-array.rb b/c_glib/test/test-boolean-array.rb
index ae22bce..ac07ec9 100644
--- a/c_glib/test/test-boolean-array.rb
+++ b/c_glib/test/test-boolean-array.rb
@@ -44,7 +44,7 @@ class TestBooleanArray < Test::Unit::TestCase
   end
 
   def test_values
-    require_gi_bindings(3, 1, 9)
+    require_gi_bindings(3, 3, 1)
     builder = Arrow::BooleanArrayBuilder.new
     builder.append(true)
     builder.append(false)
diff --git a/c_glib/test/test-record-batch-builder.rb b/c_glib/test/test-record-batch-builder.rb
index 1bb7282..030cc78 100644
--- a/c_glib/test/test-record-batch-builder.rb
+++ b/c_glib/test/test-record-batch-builder.rb
@@ -17,6 +17,7 @@
 
 class TestRecordBatchBuilder < Test::Unit::TestCase
   include Helper::Buildable
+  include Helper::Omittable
 
   def setup
     @fields = [
@@ -61,6 +62,7 @@ class TestRecordBatchBuilder < Test::Unit::TestCase
   end
 
   def test_flush
+    require_gi_bindings(3, 3, 1)
     arrays = {
       "visible" => build_boolean_array([true, false, true]),
       "point"   => build_int32_array([1, -1, 0]),
diff --git a/c_glib/test/test-tensor.rb b/c_glib/test/test-tensor.rb
index 4f18011..31f2556 100644
--- a/c_glib/test/test-tensor.rb
+++ b/c_glib/test/test-tensor.rb
@@ -66,12 +66,12 @@ class TestTensor < Test::Unit::TestCase
   end
 
   def test_shape
-    require_gi_bindings(3, 1, 2)
+    require_gi_bindings(3, 3, 1)
     assert_equal(@shape, @tensor.shape)
   end
 
   def test_strides
-    require_gi_bindings(3, 1, 2)
+    require_gi_bindings(3, 3, 1)
     assert_equal([4, 2, 1], @tensor.strides)
   end