Recent searches


No recent searches

Chat SDK V2 Memory issue iOS



Posted May 18, 2022

Hi,

We are using Chat SDK V2 and we see some memory issues. We are presenting the chat as modal and on dismiss we could see instances of `ChatSDK` being retained. The view is getting destroyed properly.

[Strange I am unable to upload any images from the memory graph] so posting some of the contents... as you can see, if I go to the screen around 10 times, you get those many objects retained.

0. ChatSDK(74)

1. ChatEngineStarter (9)

2. ChatFormHandler(9)

3.ZDKChatEngine(9)

4.ZDKChatFormConfiguration(10)

We are building the UI like this 

    func buildUI() throws -> UIViewController {

        // Name for Bot messages

        let messagingConfiguration = MessagingConfiguration()

        messagingConfiguration.name = “Bot"

        let formConfiguration = ChatFormConfiguration(name: .required, email: .required, phoneNumber: .required, department: .required)

        let chatConfiguration = ChatConfiguration()

        chatConfiguration.isAgentAvailabilityEnabled = false

        chatConfiguration.isPreChatFormEnabled = true

        chatConfiguration.chatMenuActions = [.emailTranscript, .endChat]

        chatConfiguration.preChatFormConfiguration = formConfiguration

        

        // Build view controller

        let chatEngine = try ChatEngine.engine()

        return try Messaging.instance.buildUI(engines: [chatEngine], configs: [messagingConfiguration, chatConfiguration])

    }


0

12

12 comments

image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Anoop,

Dismissal of the modal won't cut the session, this would defeat the purpose of push notifications and the like. We talk about the conditions of when the session will terminate here.
 
Hope this helps

0


I understand that but my concern is that if I open the modal multiple times why the allocation is increasing even if it is only one session, sdk should ideally reuse the stuffs from an existed session right. For example if I close and open modal 9 times with in the same session I end up seeing 9 chat engines which is alive in the memory why is that so? or am I wrong.

ZDKChatEngine(9) 

0


image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Anoop,

My assumption on why this is happening is because you're engaging the view from outside the navigation stack. When doing this the app wouldn't have a way of checking if there is an engine running as it's outside the navigation controller. I'd attempt modifying your code to use the navigation controller like in our example and see if that solves your issue. 

0


Okay , I tried that now using the existing navigationcontroller and result is the same.

0


image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Anoop,

I haven't been able to replicate this on my side. Would you try using one of our sample applications and let me know if you encounter this issue?

0


Okies which one corresponds to that ? is it this https://github.com/zendesk/ios_sdk_demo_apps/tree/master/ChatSDKSamples ?

0


Hi Eric Nelson,

I have created a sample app where you can see the issue. Whats the best way to share it with you?

0


image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Anoop,

Sorry I missed your message, mind if I move this into a ticket so that you can share the sample app with me? 

Thanks!

0


Hi Eric Nelson,

Yes that would be fine and let me know the right place to upload.

-anoop

0


image avatar

Eric Nelson

Zendesk Developer Advocacy

Hey Anoop,

I just opened up a ticket on your behalf, I've also included instructions in that on how best to send me the application.

Thanks!

0


Hi Eric Nelson

Added the source code to the ticket itself.

-anoop

0


image avatar

Eric Nelson

Zendesk Developer Advocacy

Sounds good Anoop, I've taken a look and responded back. I'll continue engaging via that ticket from here on. 
 
Thanks!

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post