0

I have my old data model, my new model (same but with two more text fields in one entity) and a mapping model (just the default generated one).

When I do automatic migration, I get a crash and a stacktrace that looks like it's entered an endless loop, 62851 stack frames, mostly _PF_Handler_Public_GetProperty and descriptions on NSManagedObject, terminated by a malloc error, which I assume is the endless loop running out of memory on my device.

stack trace

Do you have any idea what can lead to such an endless loop? I have no idea where to start debugging this.

Cheers

Nik

westsider
  • 4,967
  • 5
  • 36
  • 51
niklassaers
  • 8,480
  • 20
  • 99
  • 146

2 Answers2

2

Start under debugger and then click pause. Then try to step thru and try to find the reason for looping. Could it be that the same data is read again and again without stepping forward? If this doesn't help, comment out some code and see if it reproduces. Keep doing so and you may find your faulty block. This post might be helpful How do I debug my program when it hangs?.

Community
  • 1
  • 1
Schultz9999
  • 8,717
  • 8
  • 48
  • 87
  • With auto-migration, there's only one line of code that's mine: [persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:dict error:&error]; The rest of the stack trace, the 628xx stack frames, is Apple's, and happens very, very quickly, split-second. – niklassaers Jan 13 '11 at 19:07
  • Would it be possible you have circular dependencies in your data objects? – Schultz9999 Jan 14 '11 at 00:33
  • Yes, that is very likely. Is that a problem? After all, Apple strongly advices to have a relationship go both ways? – niklassaers Jan 22 '11 at 11:16
  • Circular dependencies will keep your refcounts not zero thus preventing GC from collecting them. – Schultz9999 Jan 22 '11 at 20:44
  • You don't manage refcounts with CoreData objects, and references from one object to another are not really things that are retained references... – Kendall Helmstetter Gelner Feb 19 '11 at 17:23
0

Have you overrode "description" in your Core Data objects? You are not supposed to use custom description methods with Core Data objects.

Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150