1

I have an object which Parse is refusing to let me save because of it's 128kB limit... Following along with this handy SO post: Checking the size of an object in Objective-C, I was able to output the size of my object in question as 144 (malloc_size is not specific about its units, but I assumed bytes). If this is in kB, my object is indeed over the 128kB limit. However, this object should never be in the kB range -- it's two pointers and a three NSNumbers (used as booleans)... Even allowing for object overhead and over-allocations on a 64bit system, we're still in the 200 byte range -- with Parse's overhead, we'll be safe and say 1kB. Still... much less than 128kB.

Specific error is: Error: The object is too large -- should be less than 128 kB. (Code: 116, Version: 1.5.0)

This got me thinking -- what are some good tools for testing or log statements for debugging this type of problem? I'm mostly familiar with the profilers Apple includes and standard C/C++ tools like Valgrind, but I'm not sure about memory introspection on a specific object to tell which attribute is hogging its RAM...

More specific to the project listed above -- What kind of trickery is Parse employing such that three NSNumbers and two pointers take up 128kB on save, and how do I debug this?

Community
  • 1
  • 1
Chase Holland
  • 2,178
  • 19
  • 23

2 Answers2

2

For those looking for the answer to why Parse is giving this error -- the answer is there is a bug in Parse. I took Ryan's suggestion and additionally debugged with breakpoints, and the objects were indeed nowhere near the size Parse was alleging they were.

I cleared the Parse database -- the error went away across the board and has not returned since.

For those looking to do profiling, Apple's built in profiler is a good place to start (Product->Profile->Allocations) -- after that, outputting memory size on specific member variables from the link in the original question, and then when all else fails, using breakpoints and printing sizes in LLVM's console.

Unfortunately, I have been unable to locate a more automated way of doing all of this.

Hope this helps someone in the future.

Chase Holland
  • 2,178
  • 19
  • 23
0

An easy way to debug object size size is right inside Xcode with break points at run time. Check the object size in memory with a breakpoint right before you attempt your save. You could also break down the object by components via a series of dummy objects to get their sizes individually.

Ryan Kreager
  • 3,571
  • 1
  • 20
  • 35