Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFRelease & common_removeAllObjects #103

Open
stefanosisto opened this issue Jul 30, 2018 · 13 comments
Open

CFRelease & common_removeAllObjects #103

stefanosisto opened this issue Jul 30, 2018 · 13 comments

Comments

@stefanosisto
Copy link

Hello. I have 2.1.0 version of pod and I'm having a lot of crash reported with Fabric.
Iphone 5 and 5C, not other iphone.
I've send to you the crash reports in your email. I'm waiting for a solution. Thanks

@stefanosisto
Copy link
Author

stefanosisto commented Jul 31, 2018

these are the crashes on 5 & 5c 10.3.3

schermata 2018-07-31 alle 17 18 25

schermata 2018-07-31 alle 17 20 45

@editfmah
Copy link
Owner

The object is being free'd. You need to hold onto the objects for their lifecycle.

@stefanosisto
Copy link
Author

Why it happens only on 10.3.3 and only on iPhone 5 & 5C? What I have to do to avoid this?

@editfmah
Copy link
Owner

Because every device has different capabilities and memory pressures. So, iOS on smaller devices may wish to cleanup more often than say an iPad Pro 12. They change these things from time to time with certain iOS builds, and SDK versions.

To stop it happening make sure you hold onto the results in a strong way, by assignment to a property or an IVar.

@editfmah
Copy link
Owner

Obviously it might not be that, as it's fairly hard to see what it could be without a full overview of the situation. But the fact that messages are being sent to a deallocated instance leads me to that juncture.

@stefanosisto
Copy link
Author

stefanosisto commented Jul 31, 2018

Can you give me an example?
Now I Have a json with 700 tuples. I'm reading it and creating NSNumber, NSString etc....
Then I'm assigning it to my istance.

So I'm doing:

Transaction ({
var obj = ObjectDB();
obj.a = 1;
obj.b = 2;
obj.c = 3;
obj.commit()
}). {
print("fail")
}

And after this insertOrUpdate, I'm just reading with queries, never more update..
So I really don't know where I'm releasing the var that I'm using.

@stefanosisto
Copy link
Author

I have an addon for this.
I've found an iphone 5c so I'm testing on it.
ViewController in which i call SharkORMManager.load(parameters).
In this method I have these lines of code:
let result = SharkORM.rawQuery(query).rawResults
let returnArray =
for r in rawResult {
let myResult = Class()
myResult.a =r[key] as! Int
myResult.b = r[key] as! Int
etc...
returnArray.append(myResult)
}
completion(returnArray).

In the ViewController i have the completion and I'm doing:
{
self.result = returnArray
tableView.reloadData()
}
And after reloadData... it crashes in the malloc!!!! (olnly on 5, 5c, ipad4) (It happens with a rawResult with >200 rows)
self.result is correctly assigned, it has the values before reloadData(). But I think it's something releasing memory by Shark before all the value are stored in my array... something like that. Btw it crashes exactly after .reloadData() in the malloc() of SRK.
I was thinking about memory issue passing in the completion, so I've tried also to move (just for testing) the code in the viewController. So i'm calling rawResult in the viewController and cicling on it. But it crashes at same point after tableView.reloadData()
Any suggestion?

@stefanosisto
Copy link
Author

@editfmah Another update...
It crashes also on iPhone 5 simulator on my macbook. So I Think is something related to iOS 10, not a memory issue with the phone...

schermata 2018-08-01 alle 18 35 41

@stefanosisto
Copy link
Author

No solution for this? It crashes every time if I use an iPhone 5 simulator (or real device iPhone 5) with iOS 10.3 (or less). No crash in iPhone 5s simulator (or real device iPhone 5s) with iOS 10.3 @editfmah

@editfmah
Copy link
Owner

Hi @stefanosisto,

I have just tried one of our products on an iPhone 5, iOS 10.0.2 and I could not replicate your issue. That said, we are not driving much from table views so it is not a particularly accurate test.

Could you enable Zombie objects in the schema and see if you hit any zombie objects before the point you normally get this crash.

Thanks

@stefanosisto
Copy link
Author

If you have skype, we can talk on Skype and I can share my screen. But only if you have 5 minute. So I can show you better what ( and when ) happens

@editfmah
Copy link
Owner

Sure thing, I will be available in around an hour if that's okay. My skype handle (*installs skype), is/was adrian_herridge

@stefanosisto
Copy link
Author

Ok, i will be online :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants