1

I get this error from the box sdk when I try to upload a file. It never occurs on the first upload. Always on the second upload. (I upload 25 files, I upload 25 again and this memory error pops up)

I tracked the problem down to box code with NSZombies. Basically the NSStream Delegate in the "BoxAPIMultiPartToJSONOperation.m" file is sending a message/calling a method on the object at this address after it gets deallocated.

My guess is that it's this line [self performSelector:@selector(retryWrite:) withObject:theStream afterDelay:0.1];

There was a github issue about this a while ago: https://github.com/box/box-ios-sdk-v2/issues/76

The issue there was that the NSStream delegate was calling a method on something after it was supposed to be cancelled. Was resolved by making sure to shut off the stream once the thing finished.

My latest idea is to try and kill the Box API threads (yeah I'm that desperate.)

If anyone has faced this specific issue I'd love to hear how you resolved it.

Thanks.

yvanscher
  • 1,009
  • 1
  • 13
  • 16
  • 1
    I've never used this API, but can you wrap some code in `@try/@catch/@finally` or make sure your references to whatever is zombifying are `strong`? or if you suspect that one line is the issue, wrapping it in a conditional that checks if the stream is nil? – Louis Tur Mar 22 '15 at 01:27
  • Hey Louis. I tried making the references to the object strong, that didn't help. I threw it into try/catch that didn't do anything. Testing for nil didn't work either. They had an autorelease pool around their `[[NSRunLoop currentRunLoop] run];`, tried getting rid of that. I tried all of these things at once. I wish this would work for more than one set of API operations. Box doesn't use ARC and obviously there's some internal problem. Thread destruction is probably the next thing I'll test as horrible as that sounds. – yvanscher Mar 22 '15 at 02:38
  • 1
    @yvanscher, Box just released new set of SDKs, I'd encourage you to try to switch to them and report this as in issue on Box github page. https://github.com/box/box-ios-content-sdk – Boris Suvorov May 09 '15 at 22:11
  • Thanks, I'll be sure to check out the new SDK. Hopefully it is a bit better than the old one. The issue was already written about on github. I could re-open the thread, we'll see. – yvanscher May 10 '15 at 21:36

0 Answers0