Re: big memory leak in GSString

2013-01-08 Thread Richard Frith-Macdonald
On 8 Jan 2013, at 00:28, Pirmin Braun wrote: the substrings of a substring retain their string from which they where splitted off; when those 2nd generation substrings are retained, the 1st generation substrings won't get deallocated; but they should, they are just intermediate objects;

Re: big memory leak in GSString

2013-01-08 Thread Pirmin Braun
Am Tue, 8 Jan 2013 09:43:22 +0100 schrieb Fred Kiefer fredkie...@gmx.de : The behaviour in GNUstep is just as you describe, but this shouldn't lead to a real memory leak. The original string still will get released when the substrings get released. If the livespan of these strings should

Re: big memory leak in GSString

2013-01-08 Thread David Chisnall
On 8 Jan 2013, at 14:41, Pirmin Braun wrote: NSString *s1 = [[a oai:i]copy]; For an immutable string, -copy just calls retain. If you want to actually copy the string, do something like: NSString *s1 = [NSString stringWithUTF8String: [old UTF8String]]; (for better performance, you

Re: big memory leak in GSString

2013-01-08 Thread Pirmin Braun
Am Tue, 8 Jan 2013 14:51:07 + schrieb David Chisnall thera...@sucs.org : On 8 Jan 2013, at 14:41, Pirmin Braun wrote: NSString *s1 = [[a oai:i]copy]; For an immutable string, -copy just calls retain. If you want to actually copy the string, do something like: NSString *s1

Re: big memory leak in GSString

2013-01-08 Thread Richard Frith-Macdonald
On 8 Jan 2013, at 15:35, Pirmin Braun wrote: Am Tue, 8 Jan 2013 14:51:07 + schrieb David Chisnall thera...@sucs.org : On 8 Jan 2013, at 14:41, Pirmin Braun wrote: NSString *s1 = [[a oai:i]copy]; For an immutable string, -copy just calls retain. If you want to actually

Re: big memory leak in GSString

2013-01-08 Thread Chan Maxthon
Why wouldn't you guys just use libobjc2 and ARC? 发自我的 iPad 在 2013-1-8,23:42,Richard Frith-Macdonald rich...@tiptree.demon.co.uk 写道: On 8 Jan 2013, at 15:35, Pirmin Braun wrote: Am Tue, 8 Jan 2013 14:51:07 + schrieb David Chisnall thera...@sucs.org : On 8 Jan 2013, at 14:41, Pirmin

Re: big memory leak in GSString

2013-01-08 Thread Richard Frith-Macdonald
On 8 Jan 2013, at 15:45, Chan Maxthon wrote: Why wouldn't you guys just use libobjc2 and ARC? Or garbage collection ... which has been around for ages! People don't use these features because they are all non-standard, in that they aren't on most systems. The vast majority of systems come

Modern server socket programming?

2013-01-08 Thread Marcus Müller
Hi all, I've just started to port a rather tiny Bonjour-service based server application from OSX to GNUstep (running on FreeBSD 9.1). Because this is a new-school ObjC 2.0 ARC based project, I've also installed all prerequisites for doing that: brand new clang, libobjc2. Everything works as

Re: Modern server socket programming?

2013-01-08 Thread David Chisnall
Hi Marcus, The easiest way of scheduling a socket in the run loop is to remember that sockets are just file descriptors and so can be wrapped in an NSFileHandle and connected to a notification. This is easy from anything that allows you to get the underlying file descriptor for the socket,

Re: Modern server socket programming?

2013-01-08 Thread Chan Maxthon
You can mix ARC and non-ARC code, given that those code are placed in separate files, then link them together. So you can safely implement the missing link in ARC code using Objective-C categories, and link them together with non-ARC GNUstep and your project in ARC. 发自我的 iPad 在

Re: Modern server socket programming?

2013-01-08 Thread Marcus Müller
On 08.01.2013, at 18:02, Chan Maxthon xcvi...@me.com wrote: You can mix ARC and non-ARC code, given that those code are placed in separate files, then link them together. So you can safely implement the missing link in ARC code using Objective-C categories, and link them together with

Re: Modern server socket programming?

2013-01-08 Thread Marcus Müller
On 08.01.2013, at 18:00, David Chisnall thera...@sucs.org wrote: Hi Marcus, The easiest way of scheduling a socket in the run loop is to remember that sockets are just file descriptors and so can be wrapped in an NSFileHandle and connected to a notification. I don't understand what you

Re: Modern server socket programming?

2013-01-08 Thread Chan Maxthon
In this circumstance, I would replace GNUstep with Apple's CoreFoundation (it's open, despite branded with Apple) and lay Cocotron on it, then use GNUstep to provide everything that is missing. Cocotron is an implementation of Foundation (GNUstep Base) using open sourced code and based on

Re: Modern server socket programming?

2013-01-08 Thread Marcus Müller
Hi Chan, In this circumstance, I would replace GNUstep with Apple's CoreFoundation (it's open, despite branded with Apple) and lay Cocotron on it, then use GNUstep to provide everything that is missing. Cocotron is an implementation of Foundation (GNUstep Base) using open sourced code and

Re: Modern server socket programming?

2013-01-08 Thread Richard Frith-Macdonald
On 8 Jan 2013, at 16:55, Marcus Müller wrote: SOLUTION? == Searching for alternatives I've stumbled across GSSocketServerStream (GSInetServerStream, …) which seems to be something that I could use, but haven't found any code demonstrating how to use it. Does anybody have any

Re: Modern server socket programming?

2013-01-08 Thread Marcus Müller
On 08.01.2013, at 18:38, Richard Frith-Macdonald rich...@tiptree.demon.co.uk wrote: Look at the code in gnustep-base (NSURLProtocol.m) for an example of using the NSStream based stuff to make an HTTP (or HTTPS) request to a remote system. I don't have any demo/example code for a server,

Re: Modern server socket programming?

2013-01-08 Thread Richard Frith-Macdonald
On 8 Jan 2013, at 17:38, Richard Frith-Macdonald wrote: On 8 Jan 2013, at 16:55, Marcus Müller wrote: SOLUTION? == Searching for alternatives I've stumbled across GSSocketServerStream (GSInetServerStream, …) which seems to be something that I could use, but haven't found

Re: Modern server socket programming?

2013-01-08 Thread Ivan Vučica
8. 1. 2013., u 18:19, Marcus Müller z...@mulle-kybernetik.com je napisao: I don't understand what you mean by connected to a notification. David is, if I understand correctly, referring to using methods such as -[NSFileHandle acceptConnectionInBackgroundAndNotify] after creating the file

Re: Modern server socket programming?

2013-01-08 Thread Marcus Müller
Hi Ivan, I don't understand what you mean by connected to a notification. David is, if I understand correctly, referring to using methods such as -[NSFileHandle acceptConnectionInBackgroundAndNotify] after creating the file handle with -[NSFileHandle