views:

10

answers:

1

I have this bit of code:

 CFDictionaryRef lDictionary = AACreateDictionaryForFile(path);
 if (lDictionary) {
      printf("retct before: %ld\n", CFGetRetainCount(lDictionary));
      CFMakeCollectable(lDictionary);
      printf("retct after: %ld\n", CFGetRetainCount(lDictionary));
      return TRUE;
 } else {
      return FALSE;
 }

Surprisingly, after the the code is run the console shows the following output:

retct before: 1
retct after: 2147483647

I would have expected:

retct before: 1
retct after: 0

Am I doing something wrong? Do I have incorrect expectations?

A: 

2147483647 is (2^31)-1: that's the maximum value for a 32 bit signed integer.

The garbage collector certainly uses this value as a kind of flag. So don't worry, your code is OK.

Macmade