[gold patch RFC]: Release unused external member of thin archive
Cary Coutant
ccoutant@google.com
Mon Jul 12 21:16:00 GMT 2010
> 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
More information about the Binutils
mailing list