# Dl memory leak

**URL:** <https://www.ruby-forum.com/t/dl-memory-leak/88547>\
**Category:** Development\
**Created:** [March 12, 2007, 3:42pm UTC](https://www.ruby-forum.com/t/dl-memory-leak/88547 "2007-03-12T15:42:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheepman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepman](https://www.ruby-forum.com/u/sheepman)\
**Post date:** [March 12, 2007, 3:42pm UTC](https://www.ruby-forum.com/t/dl-memory-leak/88547/1 "2007-03-12T15:42:49Z")

</div>

e$B$3$s$P$s$O!"e(Bsheepman e$B$G$9!#e(B

e$B%j%j!\<%94V6a$G5$$,0z$1$^$9$,!"e(Bruby/dl e$B$,%a%b%j!\<%j!\<%/$re(B  
e$B5/$3$7$F$$$^$9!#0J2\<$O%Q%C%A$G$9!#e(B

# 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

---

<div class="post-metadata">

**Author:** ![sheepman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepman](https://www.ruby-forum.com/u/sheepman)\
**Post date:** [March 12, 2007, 7:34pm UTC](https://www.ruby-forum.com/t/dl-memory-leak/88547/2 "2007-03-12T19:34:26Z")

</div>

At Mon, 12 Mar 2007 23:41:59 +0900,  
sheepman wrote:

> ãƒªãƒªãƒ¼ã‚¹é–“è¿‘ã§æ°—ãŒå¼•ã‘ã¾ã™ãŒã€ruby/dl ãŒãƒ¡ãƒ¢ãƒªãƒ¼ãƒªãƒ¼ã‚¯ã‚’  
> èµ·ã“ã—ã¦ã„ã¾ã™ã€‚ä»¥ä¸‹ã¯ãƒ‘ãƒƒãƒã§ã™ã€‚

ã€€ã‚ã‚ŠãŒã¨ã†ã”ã–ã„ã¾ã™ã€‚1.8.6ãƒªãƒªãƒ¼ã‚¹ã«ã¯å…¥ã‚Œã¾ã›ã‚“ã§ã—ãŸãŒã€  
å¾Œã»ã©å¯¾å¿œã—ã¾ã™ã€‚

–  
/  
/\_\_ \_\_ [Akinori.org](http://Akinori.org) / [MUSHA.org](http://MUSHA.org)  
/ ) ) ) ) / [FreeBSD.org](http://FreeBSD.org) / [Ruby-lang.org](http://Ruby-lang.org)  
Akinori MUSHA aka / (\_ / ( (\_\_( @ [iDaemons.org](http://iDaemons.org) / and.or.jp

“Different eyes see different things,  
Different hearts beat on different strings –  
But there are times for you and me when all such things agree”
