I’m trying to create memory leaks as directed on page 385 (3rd ed. of the book). I commented out the
CFMakeCollectable(colour); line so that the CG colour member wouldn’t be collected and I replaced the
terms = NSAllocateCollectable(termCount * sizeof(CGFloat), 0); line with a straight call to malloc:
terms = malloc(termCount * sizeof(CGFloat);
But when I check the memory performance in Instruments, the Colour and Polynomial counts still go down after deleting them through the UI! What gives? Have I missed something obvious? This is using XCode 3.2 set to a 10.6 | Debug | x86_64 configuration.
EDIT: oops - forgot to save the changes! So now the Colour count stays the same when deleting polynomials as expected. But the polynomial count still isn’t dropping with the above (saved!) changes.