quellish

Los Angeles, CA

1d
comment Core Data Transformable Attributes (NSArray) is empty
See updated answer
1d
revised Core Data Transformable Attributes (NSArray) is empty
added information about faulting
2d
answered Objective-C Subclassing: Do superclass methods have to be declared in the header file to be used in the subclass?
2d
comment How to free memory after using NSJSONSerialization?
@CroiOS, if I am reading your comment correctly you are saying that you are passing NSJSONSerialization 17 MB of NSData? And your application heap is increasing to 30MB, of which 13MB or so is the JSON, and 17 is the NSData?
2d
comment How to free memory after using NSJSONSerialization?
@CroiOS to answer your question you would need to at the very least post an Instruments trace.
2d
comment How to free memory after using NSJSONSerialization?
@HotLicks, the mutable leaves option does not influence wether new strings are allocated or not. It determines wether the value classes used are immutable (i.e. NSString) or mutable (i.e. NSMutableString). The values are allocated in the same way in both cases. The NSData object used by +dataWithContentsOfFile: is created using -initWithBytes:length:copy:freeWhenDone:bytesAreVM: after opening the file with NSReadBytesFromFileWithExtendedAttributes.Both make heavy use of VM and memory mapping. Releasing the NSData instance will not guarantee the buffers will be released immediately.
2d
comment How to free memory after using NSJSONSerialization?
@HotLicks absolutely it is. The values are pointers into the byte buffers. For example, _newJSONValue() finds byte offsets in the buffer that contain string keys (or values) and calls into __newJSONString(), which then creates NSString instances using -initWithBytesNoCopy:length:encoding:freeWhenDone:. At no point is the data that was read from the file copied. And, notably, the argument to freeWhenDone is 0x1. You can see this yourself by looking at the assembly of Foundation or using Instruments.
2d
comment How to free memory after using NSJSONSerialization?
Yes, there is logic. -dataWithContentsOfFile: returns an NSData instance that will load data from the file into a memory mapped buffer on demand. This is not efficient the way you are doing it. +JSONObjectWithData:options:error: is causing that NSData to hit the file over and over and not effectively reuse buffers. The NSDictionary returned from NSJSONSerialization is just a collection of pointers into those buffers. When you nil out the dictionary there is no effect on the pointers. Post your Instruments trace.
2d
comment How to free memory after using NSJSONSerialization?
Yes, and that is expected. You are telling the JSON parser to take jsonData, parse it, and turn it into Foundation objects. This is what JSON parsers do. If you are giving it a lot of data, that is going to take a lot of memory. The memory you use in the heap is not as significant as the dirty VM pages, which you can see in Instruments. How large is the instance of jsonData you are passing?
2d
comment How to free memory after using NSJSONSerialization?
As @HotLicks has pointed out, you should be using the Leaks or Allocations templates of Instruments to diagnose this issue. Otherwise you are only guessing.
2d
comment iOS: View controllers are not releasing when dismissing
What does Instruments tell you?
2d
revised Crashing with Terminating app due to uncaught exception 'NSUnknownKeyException
added tldr
2d
answered Crashing with Terminating app due to uncaught exception 'NSUnknownKeyException
Jan
24
answered Core Data Transformable Attributes (NSArray) is empty
Jan
24
comment Core Data Transformable Attributes (NSArray) is empty
"when the route is not optional I get Cocoa Error 1570" You're hitting the validation rule - you're attempting to save an object that has a nil value for a non-optional attribute.
Jan
24
comment Core Data Transformable Attributes (NSArray) is empty
I think I know what the issue is. Please post saveNewRunWithDate and the interface declaration for the RunDataModel NSManagedObject class. Post it in the question or link to it. fetchEntityWithName would be helpful as well, but is probably not critical.
Jan
24
comment Core Data Transformable Attributes (NSArray) is empty
"Do I need to add a Value Transformer Name, what is that?" No. You want to use the default, so leave that blank. This is covered well in the documentation for non-standard persistent attributes.
Jan
24
comment Core Data Transformable Attributes (NSArray) is empty
According to your screenshot you do have validation rules in your model: for example, "optional" is unchecked. If optional is not checked, the object will not validate (and will not save) unless there is a value for "route".
Jan
24
comment Releasing iOS app with "zoomed mode" to app store
Issues like this are exactly what differentiates seasoned developers from newbies.
Jan
23
comment Core Data Transformable Attributes (NSArray) is empty
@Sam, can you change "NSArray *immutableRoute = route;" to "NSArray *immutableRoute = [route copy];" for correctness, and to rule out several ARC related behaviors?
1 2 3 4 5