public
Description: The Nu programming language.
Homepage: http://programming.nu
Clone URL: git://github.com/timburks/nu.git
Tighter memory management, but leaving some unresolved issues with nib 
file outlets.

These changes reinstate automatic releasing of "automatic"
Nu instance variables; these are the variables created
automatically when they are accessed for classes whose
definitions include the (ivars) operator.

Other instance variables are not automatically released
when their owners are deallocated, because I learned
that when they are set as outlets in nib files, their
values aren't retained.  This may require a separate
declaration type ("outlet" or "weak" instead of "id")
and until this is resolved, we potentially leak objects
assigned to declared instance variables.

An update to Nu to support GC would eliminate the need
for this, but Nu also needs to work on platforms without GC.

Also, on the subject of other platforms, the iPhone
build is now broken because (until recently at least),
the iPhone SDK does not support NSMapTables. That's
too bad, because the NSMapTable interface is really nice,
but portability is better, so I plan to replace them with
the symbol tables implemented in the st.[hc] files.
timburks (author)
Thu May 29 20:59:53 -0700 2008
commit  0d3eabdae9256b14d49e23bf96eff675a9fe7ebc
tree    f6b80ed90b7f63cd4d3c95dd69335bf6bf2880a7
parent  03056950a5a48cce555b8ea47e21246d7672f2cd
...
3
4
5
 
...
3
4
5
6
0
@@ -3,3 +3,4 @@ build
0
 mininush
0
 nush
0
 Nu.framework
0
+libNu.a
...
23
24
25
26
27
28
29
...
23
24
25
 
26
27
28
0
@@ -23,7 +23,6 @@ static NSMapTable *ivarsToRelease = NULL;
0
 // use this to remember that instance variables created by Nu must be released when their owner is deallocated.
0
 void nu_registerIvarForRelease(Class c, NSString *name)
0
 {
0
- return; // temporarily disable ivar releases.
0
     if (!ivarsToRelease) {
0
         //NSLog(@"creating ivarsToRelease map table");
0
         ivarsToRelease = NSCreateMapTable(NSIntegerMapKeyCallBacks, NSObjectMapValueCallBacks, 0);
...
258
259
260
261
262
 
263
264
265
...
258
259
260
 
 
261
262
263
264
0
@@ -258,8 +258,7 @@ void NuInit()
0
         [NSSet include: [NuClass classWithClass:[NuEnumerable class]]];
0
         [pool release];
0
 
0
- // temporarily disabled
0
- // [NSObject exchangeInstanceMethod:@selector(dealloc) withMethod:@selector(nuDealloc)];
0
+ [NSObject exchangeInstanceMethod:@selector(dealloc) withMethod:@selector(nuDealloc)];
0
 
0
 
0
         #ifdef DARWIN
...
1534
1535
1536
1537
 
1538
1539
1540
...
1534
1535
1536
 
1537
1538
1539
1540
0
@@ -1534,7 +1534,7 @@ id loadNuLibraryFile(NSString *nuFileName, id parser, id context, id symbolTable
0
             [[variableName stringValue] cStringUsingEncoding:NSUTF8StringEncoding],
0
             [signature cStringUsingEncoding:NSUTF8StringEncoding]);
0
         if ([signature isEqual:@"@"]) {
0
- nu_registerIvarForRelease(classToExtend, [variableName stringValue]);
0
+ //nu_registerIvarForRelease(classToExtend, [variableName stringValue]);
0
         }
0
         //NSLog(@"adding ivar %@ with signature %@", [variableName stringValue], signature);
0
     }
...
38
39
40
41
 
42
43
 
44
45
46
...
38
39
40
 
41
42
 
43
44
45
46
0
@@ -38,9 +38,9 @@
0
                (assert_equal 0 (NuTestHelper deallocationCount))))
0
         (assert_equal 10 (NuTestHelper deallocationCount)))
0
      
0
- (- disabled_testIvarReleaseOnDealloc is
0
+ (- testIvarReleaseOnDealloc is
0
         (class IvarReleaseHelper is NuTestHelper
0
- (ivar (id) x)
0
+ ;;(ivar (id) x) ;; currently declared ivars are not released, this is consistent with unretained outlets
0
              (ivars)
0
              (ivar-accessors)
0
              (set myDeallocationCount 0) ;; closure gives this variable class scope.

Comments

    No one has commented yet.