You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/26 00:22:48 UTC

[GitHub] [arrow] kou commented on a diff in pull request #13224: ARROW-16648: [GLib] Add MemoryPool wrapper

kou commented on code in PR #13224:
URL: https://github.com/apache/arrow/pull/13224#discussion_r882211739


##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;

Review Comment:
   ```suggestion
     arrow::MemoryPool *memory_pool;
   ```
   
   We use C style in this file.



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.

Review Comment:
   ```suggestion
    *   through this allocator.
   ```
   



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1

Review Comment:
   ```suggestion
    *   returns -1.
   ```
   



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).
+ *
+ * Since: 9.0.0
+ */
+gchar *
+garrow_memory_pool_get_backend_name(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return g_strdup(arrow_memory_pool->backend_name().c_str());
+}
+
+G_END_DECLS
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw(arrow::MemoryPool *memory_pool)
+{
+  return garrow_memory_pool_new_raw_bytes(memory_pool);
+}
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw_bytes(arrow::MemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = GARROW_MEMORY_POOL(g_object_new(GARROW_TYPE_MEMORY_POOL,
+                                              "memory-pool", memory_pool,
+                                              NULL));
+  return arrow_memory_pool;

Review Comment:
   ```suggestion
     return GARROW_MEMORY_POOL(g_object_new(GARROW_TYPE_MEMORY_POOL,
                               "memory-pool", memory_pool,
                               NULL));
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",

Review Comment:
   ```suggestion
                                 "The raw arrow::MemoryPool *",
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()

Review Comment:
   Could you rename this to `garrow_memory_pool_default()` so that we can use `Arrow::MemoryPool.default` in Ruby?
   
   ```suggestion
   garrow_memory_pool_defaultl(void)
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.

Review Comment:
   ```suggestion
    *   through this allocator.
   ```
   



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).
+ *

Review Comment:
   ```suggestion
    *
    *  It should be freed with g_free() when no longer needed.
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1

Review Comment:
   ```suggestion
    *   returns -1.
   ```
   



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).
+ *

Review Comment:
   ```suggestion
    *
    *  It should be freed with g_free() when no longer needed.
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).

Review Comment:
   ```suggestion
    * The name of the backend used by this MemoryPool (e.g. "system" or
    * "jemalloc").
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()

Review Comment:
   Could you rename this to `garrow_memory_pool_default()` so that we can use `Arrow::MemoryPool.default` in Ruby?
   
   ```suggestion
   garrow_memory_pool_defaultl(void)
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).

Review Comment:
   ```suggestion
    * The name of the backend used by this MemoryPool (e.g. "system" or
    * "jemalloc").
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;

Review Comment:
   We don't need this because we don't need to return any property.
   
   ```suggestion
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;

Review Comment:
   We don't need this because `priv->memory_pool` is initialized as `NULL` by GLib. 
   
   ```suggestion
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;

Review Comment:
   We don't need this because `priv->memory_pool` is initialized as `NULL` by GLib. 
   
   ```suggestion
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).
+ *
+ * Since: 9.0.0
+ */
+gchar *
+garrow_memory_pool_get_backend_name(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return g_strdup(arrow_memory_pool->backend_name().c_str());
+}
+
+G_END_DECLS
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw(arrow::MemoryPool *memory_pool)
+{
+  return garrow_memory_pool_new_raw_bytes(memory_pool);
+}
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw_bytes(arrow::MemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = GARROW_MEMORY_POOL(g_object_new(GARROW_TYPE_MEMORY_POOL,
+                                              "memory-pool", memory_pool,
+                                              NULL));
+  return arrow_memory_pool;

Review Comment:
   ```suggestion
     return GARROW_MEMORY_POOL(g_object_new(GARROW_TYPE_MEMORY_POOL,
                               "memory-pool", memory_pool,
                               NULL));
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;

Review Comment:
   We don't need this because we don't need to return any property.
   
   ```suggestion
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.

Review Comment:
   Users need to call `g_object_unref()` for the return value when the return value is no longer needed because we always returns a new object.
   
   ```suggestion
    * Returns: (transfer full): The process-wide default memory pool.
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.

Review Comment:
   Users need to call `g_object_unref()` for the return value when the return value is no longer needed because we always returns a new object.
   
   ```suggestion
    * Returns: (transfer full): The process-wide default memory pool.
   ```



##########
c_glib/test/test-memory-pool.rb:
##########
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestMemoryPool < Test::Unit::TestCase
+  include Helper::Omittable
+
+  def setup
+    @memory_pool = Arrow.default_memory_pool
+  end
+
+  def test_bytes_allocated
+    assert(@memory_pool.bytes_allocated.positive?)

Review Comment:
   We can use power assert here:
   
   ```suggestion
       assert do
         @memory_pool.bytes_allocated.positive?
       end
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).
+ *
+ * Since: 9.0.0
+ */
+gchar *
+garrow_memory_pool_get_backend_name(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return g_strdup(arrow_memory_pool->backend_name().c_str());
+}
+
+G_END_DECLS
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw(arrow::MemoryPool *memory_pool)
+{
+  return garrow_memory_pool_new_raw_bytes(memory_pool);
+}
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw_bytes(arrow::MemoryPool *memory_pool)

Review Comment:
   We don't need `garrow_memory_pool_new_raw_bytes()`.
   
   ```suggestion
   GArrowMemoryPool *
   garrow_memory_pool_new_raw(arrow::MemoryPool *memory_pool)
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",

Review Comment:
   ```suggestion
                                 "The raw arrow::MemoryPool *",
   ```



##########
c_glib/test/test-memory-pool.rb:
##########
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestMemoryPool < Test::Unit::TestCase
+  include Helper::Omittable
+
+  def setup
+    @memory_pool = Arrow.default_memory_pool
+  end
+
+  def test_bytes_allocated
+    assert(@memory_pool.bytes_allocated.positive?)
+  end
+
+  def test_max_memory
+    assert(@memory_pool.max_memory.positive?)

Review Comment:
   We can use power assert here:
   
   ```suggestion
       assert do
         @memory_pool.max_memory.positive?
       end
   ```



##########
c_glib/arrow-glib/memory-pool.cpp:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <arrow-glib/memory-pool.hpp>
+
+G_BEGIN_DECLS
+
+/**
+ * SECTION: memory-pool
+ * @section_id: memory-pool-classes
+ * @title: memory-pool classes
+ * @include: arrow-glib/arrow-glib.h
+ *
+ * #GArrowMemoryPool is a class for memory allocation.
+ */
+
+typedef struct GArrowMemoryPoolPrivate_ {
+  arrow::MemoryPool* memory_pool;
+} GArrowMemoryPoolPrivate;
+
+enum {
+  PROP_MEMORY_POOL = 1,
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT)
+
+#define GARROW_MEMORY_POOL_GET_PRIVATE(obj)        \
+  static_cast<GArrowMemoryPoolPrivate *>(          \
+     garrow_memory_pool_get_instance_private(      \
+       GARROW_MEMORY_POOL(obj)))
+
+static void
+garrow_memory_pool_set_property(GObject *object,
+                                guint prop_id,
+                                const GValue *value,
+                                GParamSpec *pspec)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+
+  switch (prop_id) {
+  case PROP_MEMORY_POOL:
+    priv->memory_pool =
+      static_cast<arrow::MemoryPool *>(g_value_get_pointer(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_get_property(GObject *object,
+                                guint prop_id,
+                                GValue *value,
+                                GParamSpec *pspec)
+{
+  switch (prop_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
+}
+
+static void
+garrow_memory_pool_init(GArrowMemoryPool *object)
+{
+  auto priv = GARROW_MEMORY_POOL_GET_PRIVATE(object);
+  new(&priv->memory_pool) arrow::MemoryPool*;
+}
+
+static void
+garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass)
+{
+  GParamSpec *spec;
+
+  auto gobject_class = G_OBJECT_CLASS(klass);
+
+  gobject_class->set_property = garrow_memory_pool_set_property;
+  gobject_class->get_property = garrow_memory_pool_get_property;
+
+  spec = g_param_spec_pointer("memory-pool",
+                              "Memory Pool",
+                              "The raw arrow::MemoryPool* *",
+                              static_cast<GParamFlags>(G_PARAM_WRITABLE |
+                                                       G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec);
+}
+
+/**
+ * garrow_default_memory_pool:
+ * 
+ * Returns: (transfer none): The process-wide default memory pool.
+ *
+ * Since: 9.0.0
+ */
+GArrowMemoryPool *
+garrow_default_memory_pool()
+{
+  auto memory_pool = arrow::default_memory_pool();
+  return garrow_memory_pool_new_raw(memory_pool);
+}
+
+/**
+ * garrow_memory_pool_get_bytes_allocated:
+ * @memory_pool: A #GArrowMemoryPool.
+ *
+ * Returns: The number of bytes that were allocated and not yet free’d
+ * through this allocator.
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->bytes_allocated();
+}
+
+/**
+ * garrow_memory_pool_get_max_memory:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * Return peak memory allocation in this memory pool.
+ *
+ * Returns: Maximum bytes allocated. If not known (or not implemented),
+ *   returns -1
+ *
+ * Since: 9.0.0
+ */
+gint64
+garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return arrow_memory_pool->max_memory();
+}
+
+/**
+ * garrow_memory_pool_get_backend_name:
+ * @memory_pool: A #GArrowMemoryPool.
+ * 
+ * The name of the backend used by this MemoryPool (e.g. “system” or
+ * “jemalloc”).
+ *
+ * Since: 9.0.0
+ */
+gchar *
+garrow_memory_pool_get_backend_name(GArrowMemoryPool *memory_pool)
+{
+  auto arrow_memory_pool = garrow_memory_pool_get_raw(memory_pool);
+  return g_strdup(arrow_memory_pool->backend_name().c_str());
+}
+
+G_END_DECLS
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw(arrow::MemoryPool *memory_pool)
+{
+  return garrow_memory_pool_new_raw_bytes(memory_pool);
+}
+
+GArrowMemoryPool *
+garrow_memory_pool_new_raw_bytes(arrow::MemoryPool *memory_pool)

Review Comment:
   We don't need `garrow_memory_pool_new_raw_bytes()`.
   
   ```suggestion
   GArrowMemoryPool *
   garrow_memory_pool_new_raw(arrow::MemoryPool *memory_pool)
   ```



##########
c_glib/test/test-memory-pool.rb:
##########
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestMemoryPool < Test::Unit::TestCase
+  include Helper::Omittable
+
+  def setup
+    @memory_pool = Arrow.default_memory_pool
+  end
+
+  def test_bytes_allocated
+    assert(@memory_pool.bytes_allocated.positive?)
+  end
+
+  def test_max_memory
+    assert(@memory_pool.max_memory.positive?)
+  end
+
+  def test_backend_name
+    assert(%w[system jemalloc mimalloc].include?(@memory_pool.backend_name))

Review Comment:
   We can use power assert here:
   
   ```suggestion
       assert do
         %w[system jemalloc mimalloc].include?(@memory_pool.backend_name)
       end
   ```



##########
c_glib/test/test-memory-pool.rb:
##########
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestMemoryPool < Test::Unit::TestCase
+  include Helper::Omittable
+
+  def setup
+    @memory_pool = Arrow.default_memory_pool
+  end
+
+  def test_bytes_allocated
+    assert(@memory_pool.bytes_allocated.positive?)
+  end
+
+  def test_max_memory
+    assert(@memory_pool.max_memory.positive?)

Review Comment:
   We can use power assert here:
   
   ```suggestion
       assert do
         @memory_pool.max_memory.positive?
       end
   ```



##########
c_glib/test/test-memory-pool.rb:
##########
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestMemoryPool < Test::Unit::TestCase
+  include Helper::Omittable
+
+  def setup
+    @memory_pool = Arrow.default_memory_pool
+  end
+
+  def test_bytes_allocated
+    assert(@memory_pool.bytes_allocated.positive?)

Review Comment:
   We can use power assert here:
   
   ```suggestion
       assert do
         @memory_pool.bytes_allocated.positive?
       end
   ```



##########
c_glib/test/test-memory-pool.rb:
##########
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+class TestMemoryPool < Test::Unit::TestCase
+  include Helper::Omittable
+
+  def setup
+    @memory_pool = Arrow.default_memory_pool
+  end
+
+  def test_bytes_allocated
+    assert(@memory_pool.bytes_allocated.positive?)
+  end
+
+  def test_max_memory
+    assert(@memory_pool.max_memory.positive?)
+  end
+
+  def test_backend_name
+    assert(%w[system jemalloc mimalloc].include?(@memory_pool.backend_name))

Review Comment:
   We can use power assert here:
   
   ```suggestion
       assert do
         %w[system jemalloc mimalloc].include?(@memory_pool.backend_name)
       end
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org