#2414 assigned defect

Repeated call to dlopen without dlclose leaks memory.

Reported by: Pavel Pisa Owned by: Needs Funding
Priority: normal Milestone: Indefinite
Component: unspecified Version: 4.11
Severity: normal Keywords: dlopen
Cc: Blocked By:
Blocking:

Description

There are use cases where dlopen() and dlsym() are called each time when some program (interpreter) wants to call some function without need to track if given object file/dynamic library has already been loaded.

The object file handle cannot be closed by dlclose() in the case that called function is allowed to start other threads because memory used for dynamically loaded code can be reused for some other data/code in after dlclose(). It even causes unnecessary overhead for subsequent calls to load file again to memory when released previously.

So repeated call to dlopen() for the same file is useful.

According to my tests each subsequent call of of the function dlopen_forshell() in my test code leaks 32 bytes of memory on i386

http://rtime.felk.cvut.cz/gitweb/rtems-devel.git/blob/refs/heads/master:/rtems-omk-template/appdl/init.c#l109

The memory useage for simple object file containing single function with printf() call

The first dlopen call 65004 bytes. Each subsequent call without dlclose 32 bytes.

Change History (2)

comment:1 Changed on Jan 26, 2017 at 7:16:00 AM by Sebastian Huber

Milestone: 4.11.14.11.2

comment:2 Changed on Feb 15, 2017 at 1:37:51 PM by Sebastian Huber

Milestone: 4.11.2Indefinite
Owner: set to Needs Funding
Status: newassigned
Note: See TracTickets for help on using tickets.