iActiveRecord icon indicating copy to clipboard operation
iActiveRecord copied to clipboard

Leaks with NSDate

Open wsnnn opened this issue 11 years ago • 31 comments

Faced with such a problem: with each operation with a base leak. Xcode Instruments indicates iActiveRecord [NSDate dateWithTimeIntervalSince1970:] and [NSDate dateWithTimeIntervalSinceNow:]

//on the Russian Столкнулся с такой проблемой: при каждой операции с базой происходят утечки. Xcode Instruments указывает на iActiveRecord [NSDate dateWithTimeIntervalSince1970:] и [NSDate dateWithTimeIntervalSinceNow:] leaks

wsnnn avatar Jul 01 '13 20:07 wsnnn

Hi @wsnnn, could you describe steps to reproduce?

AlexDenisov avatar Jul 02 '13 03:07 AlexDenisov

And which version do you use?

AlexDenisov avatar Jul 02 '13 03:07 AlexDenisov

Hi! Download stable version 29.06.2013.

Here is the sample project. Tested on the iPad. The results are the same as above. http://yadi.sk/d/a4NYU6gV6P4-4

wsnnn avatar Jul 02 '13 07:07 wsnnn

Thank you, I'll review it soon.

AlexDenisov avatar Jul 02 '13 07:07 AlexDenisov

Could you try the new version from master branch? stable branch have a lot of bugs, and now I've implemented AR with the new API

Here is #35 some discussion, also you may review ActiveTwitter target.

P.S. or you can drop me on skype: debian.1101

AlexDenisov avatar Jul 02 '13 08:07 AlexDenisov

Tried master. The same. Added class_getSubclasses

wsnnn avatar Jul 02 '13 08:07 wsnnn

Fixed on stable branch. But I cannot reproduce this on master...

AlexDenisov avatar Jul 02 '13 09:07 AlexDenisov

By the way, ActiveTwitter uses old API http://search.twitter.com/search.json?q=test

wsnnn avatar Jul 02 '13 09:07 wsnnn

f**k, I will fix it.

AlexDenisov avatar Jul 02 '13 09:07 AlexDenisov

Maybe this will help http://yadi.sk/d/4C4WG0Qk6PIuM

wsnnn avatar Jul 02 '13 09:07 wsnnn

stable ARTest(68825,0x3d1a0b88) malloc: *** error for object 0x1f5d4890: pointer being freed was not allocated. *** set a breakpoint in malloc_error_break to debug

wsnnn avatar Jul 02 '13 09:07 wsnnn

I will review this at the evening. Anyway, I highly recommend to use version from master.

AlexDenisov avatar Jul 02 '13 09:07 AlexDenisov

While I use master. Since AR is used in the life cycle very often, the leaks are very large.

wsnnn avatar Jul 02 '13 09:07 wsnnn

I can't understand where is the problem. I had the same trace for stable, but master' trace looks good, without leaks.

AlexDenisov avatar Jul 02 '13 10:07 AlexDenisov

Master shows on each call to the database: malloc: *** error for object 0x1f5d4890: pointer being freed was not allocated.

wsnnn avatar Jul 02 '13 10:07 wsnnn

Have you called [ActiveRecord applyConfiguration... at the app start?

AlexDenisov avatar Jul 02 '13 10:07 AlexDenisov

No

wsnnn avatar Jul 02 '13 10:07 wsnnn

Could you try and leave a feedback?

AlexDenisov avatar Jul 02 '13 10:07 AlexDenisov

Posted on your mail

wsnnn avatar Jul 02 '13 10:07 wsnnn

Any thing new? I have this issue too.

holin avatar Oct 06 '13 08:10 holin

+1

alexiscreuzot avatar Oct 28 '13 21:10 alexiscreuzot

Update please?

alexgaribay avatar Nov 06 '13 18:11 alexgaribay

Guys, could someone give me a test project with these leaks?

AlexDenisov avatar Nov 06 '13 20:11 AlexDenisov

@AlexDenisov I sent you an email with a failing project presuming the email listed in the wiki is yours.

alexgaribay avatar Nov 07 '13 02:11 alexgaribay

@alexgaribay, I've received your email and will review it soon, thanks.

AlexDenisov avatar Nov 07 '13 04:11 AlexDenisov

Any updates on this? I am trying to set a property of type NSDate to something, then update the entity, but it saves null. @AlexDenisov

ghost avatar Nov 18 '13 13:11 ghost

I think it wouldn't be a bad idea to save dates as timestamps (NSNumber) for now, at least until the problem is resolved.

alexiscreuzot avatar Nov 18 '13 13:11 alexiscreuzot

@kirualex Yeah you could even save them as ISO8601 strings but that isn't solving the problem, I don't like spikes sitting somewhere in my app. Plus to that, changing even a small property like that results in a lot of refactor.

ghost avatar Nov 18 '13 13:11 ghost

I still can't reproduce it nor on master branch, nor on stable.

AlexDenisov avatar Nov 18 '13 13:11 AlexDenisov

@nemesis-fw, regarding your issue with null date: have you marked the property as @dynamic?

AlexDenisov avatar Nov 18 '13 13:11 AlexDenisov