MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to avoid leaks with Cocoa functions?
Feedback.

Answer: You can try this code on Mac OS X:
Example:
// in a Timer Action event:
Sub Action()
static LastPool as NSAutoreleasePoolMBS = nil
static CurrentPool as NSAutoreleasePoolMBS = nil

LastPool = CurrentPool
CurrentPool = new NSAutoreleasePoolMBS
End Sub
Notes:
With REALbasic 2009r4 the code above should not be needed as REALbasic runtime does automatically handle the NSAutoreleasePools for you. For older REALbasic versions you need to use code with a timer with the action event above to avoid memory leaks.

Please do not use REALbasic 2009r4 and newer with plugins before version 9.5. You can get crashes there which typically show a line with a objc_msgSend call.




Links
MBS Xojo blog