Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8268119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:45:55+00:00 2026-06-08T05:45:55+00:00

Well I am working on a non-ARC project, but use Philipp Kyeck’s socketio library

  • 0

Well I am working on a non-ARC project, but use Philipp Kyeck’s socketio library which is written using ARC. I am using the method explained in this tutorial merge non-ARC project and ARC library.

In my ViewController file I am initializing the socket using

 SockIO *chatSockIO = [[SocketIO alloc] initWithDelegate:self];

and when I need to disconnect, I call

[chatSockIO disconnect];

which results socketIODidDisconnect delegate method to fire.

- (void) socketIODidDisconnect:(SocketIO *)socket{
   [chatSockIO release]; ==> is this call needed?
}

Now my question is about the line [chatSockIO release]. Should we need to release an object which itself is defined in ARC mode, but is used in a non-ARC project?

Now when I tried the release, I got an exception saying

-[SocketIO retain]: message sent to deallocated instance 0x6fec370

but when I commented out that line, I am getting a memory leak and dealloc in my library object not getting called at all

Bounty Time!!

Forget the library I mentioned, crash in my code and leaks.. What is the usual practice when using an object defined using ARC method, in a non-ARC project. Should I only alloc it, or should I alloc and release it after use?

EDIT:Some more info.

I run zombie instrument on the crash, and this is what it had to say.. It shows the call to alloc and release functions.

#   Address     Category    Event Type  RefCt   Timestamp       Size    Responsible Library     Responsible Caller
0   0x72d5da0   SocketIO    Malloc      1       00:09.700.274   64      MyProject           -[MyViewController sendRequestForSocketIOPush]
1   0x72d5da0   SocketIO    Retain      2       00:09.700.317   0       MyProject           -[SocketIO initWithDelegate:]
2   0x72d5da0   SocketIO    Release     1       00:09.700.320   0       MyProject           -[SocketIO initWithDelegate:]
3   0x72d5da0   SocketIO    Retain      2       00:09.700.440   0       Foundation          -[NSURLConnectionInternal initWithInfo:]
4   0x72d5da0   SocketIO    Retain      3       00:10.413.717   0       Foundation          -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
5   0x72d5da0   SocketIO    Release     2       00:10.413.761   0       Foundation          -[NSURLConnectionInternalConnection invokeForDelegate:]
6   0x72d5da0   SocketIO    Retain      3       00:10.413.797   0       Foundation          -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
7   0x72d5da0   SocketIO    Release     2       00:10.413.811   0       Foundation          -[NSURLConnectionInternalConnection invokeForDelegate:]
8   0x72d5da0   SocketIO    Retain      3       00:10.413.816   0       Foundation          -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
9   0x72d5da0   SocketIO    Release     2       00:10.415.087   0       Foundation          -[NSURLConnectionInternalConnection invokeForDelegate:]
10  0x72d5da0   SocketIO    Retain      3       00:10.415.214   0       Foundation          -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
11  0x72d5da0   SocketIO    Release     2       00:10.415.216   0       Foundation          -[NSURLConnectionInternalConnection invokeForDelegate:]
12  0x72d5da0   SocketIO    Release     1       00:10.415.275   0       Foundation          -[NSURLConnectionInternalConnection invokeForDelegate:]
13  0x72d5da0   SocketIO    Retain      2       00:10.969.432   0       GraphicsServices    GSEventRunModal
14  0x72d5da0   SocketIO    Release     1       00:10.969.433   0       GraphicsServices    GSEventRunModal
15  0x72d5da0   SocketIO    Retain      2       00:10.969.434   0       GraphicsServices    GSEventRunModal
16  0x72d5da0   SocketIO    Release     1       00:10.969.456   0       GraphicsServices    GSEventRunModal
17  0x72d5da0   SocketIO    Retain      2       00:10.969.459   0       GraphicsServices    GSEventRunModal
18  0x72d5da0   SocketIO    Retain      3       00:10.969.488   0       Foundation          -[NSCFTimer initWithFireDate:interval:target:selector:userInfo:repeats:]
19  0x72d5da0   SocketIO    Release     2       00:10.976.115   0       MyProject           -[SocketIO setTimeout]
20  0x72d5da0   SocketIO    Retain      3       00:10.976.125   0       Foundation          -[NSCFTimer initWithFireDate:interval:target:selector:userInfo:repeats:]
21  0x72d5da0   SocketIO    Release     2       00:10.976.161   0       GraphicsServices    GSEventRunModal
22  0x72d5da0   SocketIO    Retain      3       00:13.935.328   0       GraphicsServices    GSEventRunModal
23  0x72d5da0   SocketIO    Release     2       00:13.935.373   0       MyProject           -[SocketIO setTimeout]
24  0x72d5da0   SocketIO    Retain      3       00:13.935.399   0       Foundation          -[NSCFTimer initWithFireDate:interval:target:selector:userInfo:repeats:]
25  0x72d5da0   SocketIO    Release     2       00:13.935.685   0       MyProject           -[SocketIO onDisconnect]
26  0x72d5da0   SocketIO    Release     1       00:13.935.705   0       MyProject           -[MyViewController socketIODidDisconnect:]
27  0x72d5da0   SocketIO    Release     0       00:13.935.716   0       GraphicsServices    GSEventRunModal
28  0x72d5da0   SocketIO    Zombie      -1      00:13.936.298   0       GraphicsServices    GSEventRunModal
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:45:58+00:00Added an answer on June 8, 2026 at 5:45 am

    To answer your question:

    If you use an ARC-managed object from non-ARC code, you use it just as you would use a non-ARC object: If you create or retain it, you have to release or autorelease it.

    Regarding your issue:

    In on of your comments you mentioned that you tried to fix the problem with initializing like this

    self.chatSockIO = [[[SocketIO alloc] initWithDelegate:self] autorelease];
    

    and in socketIODidDisconnect

    self.chatSockIO = nil;
    

    That should work fine, provided that the chatSockIO property has retain semantics, and that only one SocketIO object is used at a time.

    The Zombie output gives a hint on what’s going wrong:

    • In the second to last line, you release the object, the retain count drops to 0, and the object is deallocated. That is what you would expect.
    • In the last line however, it is tried to retain the object from the run loop. You know it’s a retain because of the exception you get without NSZombie.
    • That means although you are done with the object, it still receives calls from somewhere. This is unexpected.

    It could be either something in your code, or an error in one of the libraries you are using. Just a hunch: In SocketIO.m replace these lines in -onDisconnect

    if (_webSocket != nil) {
        [_webSocket close];
    }
    

    with

    if (_webSocket != nil) {
        [_webSocket close];
        _webSocket.delegate = nil;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have swipeleft/swiperight working well in my app but when the user does the
I am facing a strange issue.It is working well with outlook 2K3 but not
While setting up my project and working to keep apps non-dependent, I've hit a
I am accessing options from an action controller, which is working well with the
I have got Jetty and Bayeux working well together to allow me to use
I have a working WebSocket non secure application. But my website uses https and
I am trying to scroll text across the screen which is working well. Update
Code below is working well as long as I have class ClassSameAssembly in same
I have a report working well where I extract the number of logins per
I have a script working well for creating ad hoc iPhone builds. I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.