bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #25869] Registering untyped selector mutates existing selector


From: David Chisnall
Subject: Re: [bug #25869] Registering untyped selector mutates existing selector
Date: Sat, 9 Oct 2010 12:28:23 +0100

I can confirm that the test program in the bug report works as expected with 
libobjc2, returning the same string from sel_get_name() each time.

libobjc2 maintains a chain of all types for a given selector name (to allow 
sel_copyTypes_np() to be implemented, among other things) and always reuses the 
first name.  This is important for implementing things like sel_registerName(), 
which must make a copy of the string arguments.  The first time a selector is 
seen, it is most likely coming from a static definition generated by the 
compiler, so copying the string is not required.  This saves some malloc()'d 
memory.  

I agree with the comment in the original bug report that this isn't really a 
bug, but it is potentially evidence of a memory leak and of generally sloppy 
coding and bad design.

David

On 9 Oct 2010, at 11:40, Nicola Pero wrote:

> 
> Follow-up Comment #3, bug #25869 (project gnustep):
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45953
> 
> Thanks
> 
>    _______________________________________________________
> 
> Reply to this item at:
> 
>  <http://savannah.gnu.org/bugs/?25869>
> 
> _______________________________________________
>  Message sent via/by Savannah
>  http://savannah.gnu.org/
> 


-- Sent from my brain




reply via email to

[Prev in Thread] Current Thread [Next in Thread]