This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold patch RFC]: Release unused external member of thin archive
- From: Cary Coutant <ccoutant at google dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 12 Jul 2010 14:16:14 -0700
- Subject: Re: [gold patch RFC]: Release unused external member of thin archive
- References: <mcrd3usrebx.fsf@google.com>
> Hi Cary, does this patch look correct to you? ?It explicitly unlocks an
> external member of a thin archive if the member is not used. ?That
> avoids locking up the descriptor and possibly eventually running out of
> descriptors. ?I don't have a test case, but it seems like the right
> thing. ?If this looks right to you, I'll commit it.
@@ -853,11 +853,7 @@ Archive::include_member(Symbol_table* sy
&& this->searched_for()
&& obj == NULL
&& unconfigured)
- {
- if (obj != NULL)
- delete obj;
- return false;
- }
+ return false;
This was dead code anyway (the if condition explicitly tests for obj == NULL).
@@ -874,7 +870,13 @@ Archive::include_member(Symbol_table* sy
}
if (!input_objects->add_object(obj))
- delete obj;
+ {
+ // If this is an external member of a thin archive, unlock the
+ // file.
+ if (obj->offset() == 0)
+ obj->unlock(this->task_);
+ delete obj;
+ }
This looks good. Why not do this in the Object destructor, though?
-cary