Skip to content
This repository has been archived by the owner on Nov 25, 2019. It is now read-only.

Leaks with NSDate #40

Open
wsnnn opened this issue Jul 1, 2013 · 31 comments
Open

Leaks with NSDate #40

wsnnn opened this issue Jul 1, 2013 · 31 comments

Comments

@wsnnn
Copy link

wsnnn commented Jul 1, 2013

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

@AlexDenisov
Copy link
Owner

Hi @wsnnn, could you describe steps to reproduce?

@AlexDenisov
Copy link
Owner

And which version do you use?

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

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

@AlexDenisov
Copy link
Owner

Thank you, I'll review it soon.

@AlexDenisov
Copy link
Owner

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

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

Tried master. The same. Added class_getSubclasses

@AlexDenisov
Copy link
Owner

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

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

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

@AlexDenisov
Copy link
Owner

f**k, I will fix it.

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

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

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

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

@AlexDenisov
Copy link
Owner

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

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

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

@AlexDenisov
Copy link
Owner

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

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

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

@AlexDenisov
Copy link
Owner

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

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

No

@AlexDenisov
Copy link
Owner

Could you try and leave a feedback?

@wsnnn
Copy link
Author

wsnnn commented Jul 2, 2013

Posted on your mail

@holin
Copy link

holin commented Oct 6, 2013

Any thing new? I have this issue too.

@alexiscreuzot
Copy link

+1

@alexgaribay
Copy link

Update please?

@AlexDenisov
Copy link
Owner

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

@alexgaribay
Copy link

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

@AlexDenisov
Copy link
Owner

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

@ghost
Copy link

ghost commented Nov 18, 2013

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

@alexiscreuzot
Copy link

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

@ghost
Copy link

ghost commented Nov 18, 2013

@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.

@AlexDenisov
Copy link
Owner

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

@AlexDenisov
Copy link
Owner

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

@ghost
Copy link

ghost commented Nov 18, 2013

@AlexDenisov Yes, I most certainly did.

@ghost
Copy link

ghost commented Nov 20, 2013

By the way, my NSDate property is somehow getting converted into an NSNumber. Why is that? Did any of you encounter something similar to this?

@alexgaribay
Copy link

@nemesis-fw I noticed this as well. I have to change my models to not use actual dates but to use NSNumber to hold time since 1970. For me, NSDate would sometimes come as an NSDate or it would NSNumber. So I just settled on using NSNumber.

So my work around is doing this:

Saving a date

model.date = [NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]];

Getting a date

NSTimeInterval time = [model.date doubleValue];
NSDate* theDate = [[NSDate alloc] initWithTimeIntervalSince1970:time];

@juanpare
Copy link

I have same error using only one model with a NSString, this is frustrating.

@alexiscreuzot
Copy link

As this project is labeled as discontinued, I moved on to use ObjectiveRecord. It follows the same principles that iActiveRecord, but is wrapping CoreData instead of directly SQLite.

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

No branches or pull requests

6 participants