[#30549] [ANN] Ruby 1.8.6 has been released — "Akinori MUSHA" <knu@...>

 Ruby 1.8.6 をリリースしました。

14 messages 2007/03/12

[#30553] help: lib/shell for ruby 1.9 — keiju@... (Keiju ISHITSUKA)

けいじゅ@いしつかです.

13 messages 2007/03/13
[#30585] Re: help: lib/shell for ruby 1.9 — Yukihiro Matsumoto <matz@...> 2007/03/15

まつもと ゆきひろです

[#30587] Re: help: lib/shell for ruby 1.9 — keiju@... (石塚圭樹) 2007/03/15

けいじゅ@いしつかです.

[#30588] Re: help: lib/shell for ruby 1.9 — Yukihiro Matsumoto <matz@...> 2007/03/15

まつもと ゆきひろです

[ruby-dev:30547] dl memory leak

From: sheepman <sheepman@...>
Date: 2007-03-12 14:41:59 UTC
List: ruby-dev #30547
こんばんは、sheepman です。

リリース間近で気が引けますが、ruby/dl がメモリーリークを
起こしています。以下はパッチです。

Index: ptr.c
===================================================================
--- ptr.c       (revision 12047)
+++ ptr.c       (working copy)
@@ -53,6 +53,8 @@
 void
 dlptr_free(struct ptr_data *data)
 {
+  if (!data)
+    return;
   if (data->ptr) {
     DEBUG_CODE({
       printf("dlptr_free(): removing the pointer `0x%x' from the MemorySpace\n",
@@ -69,6 +71,7 @@
   if (data->stype) dlfree(data->stype);
   if (data->ssize) dlfree(data->ssize);
   if (data->ids) dlfree(data->ids);
+  dlfree(data);
 }

 void
Index: sym.c
===================================================================
--- sym.c       (revision 12047)
+++ sym.c       (working copy)
@@ -57,6 +57,8 @@
 void
 dlsym_free(struct sym_data *data)
 {
+  if(!data)
+    return;
   if( data->name ){
     DEBUG_CODE({
       printf("dlsym_free(): free(data->name:%s)\n",data->name);
@@ -69,6 +71,7 @@
     });
     free(data->type);
   }
+  dlfree(data);
 }

 VALUE
Index: handle.c
===================================================================
--- handle.c    (revision 12047)
+++ handle.c    (working copy)
@@ -10,9 +10,12 @@
 void
 dlhandle_free(struct dl_handle *dlhandle)
 {
+  if (!dlhandle)
+    return;
   if (dlhandle->ptr && dlhandle->open && dlhandle->enable_close) {
-    dlclose(dlhandle->ptr);
+    dlclose(dlhandle->ptr);
   }
+  dlfree(dlhandle);
 }

 VALUE

-- 
sheepman / TAMURA Takashi
sheepman@sheepman.sakura.ne.jp

In This Thread

Prev Next