Before Apple's ARC, you would often have to manage memory semi-manually. Before operation queues, you would also have to manage setting up autorelease pools on new threads. If you didn't, you would get an error such as:
autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
However, the other day, I started getting these myself! I was a little shocked - what on earth was I doing that required an autorelease pool? Well, eventually I figured it out. It turns out that if you have custom +load() functions on your classes (these get called whenever the classes load - I use them for registering handlers and such), this is another situation in which you have to set up your own autorelease pool if you do any object creation.
So, in your +load() function (or, depending on what you are doing, in functions that +load calls), just wrap it with
@autoreleasepool {
Your Code Here
}
And it works!
I'm teaching calculus to some homeschool students this year, and I wanted to have a bunch of function plots printed out to show them. Therefore, I turned to Sage, which I have never used. It is great! You have to know a few other math software pieces to really understand it, but it's not that bad. Someone needs to do a general "how to use sage", and some day I might.
Anyway, here's my quick function for plotting graphs for students that some of you might like.
In one of the evaluation boxes, type the following:
def simpleplot(f, range=(-5,5,-5,5)):
p = plot(f, (x, range[0], range[1]))
p += text("$" + latex(f) + "$", (0, range[2] - (range[3] - range[2]) * 0.1), fontsize=30, rgbcolor=(1,0,0))
p.axes_range(range[0], range[1], range[2], range[3])
show(p, figsize=12)
What this does is create a function called "simpleplot" which will do the following:
Now, I can just do:
simpleplot(1/x)
And it gives me my output!