Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Mar 2010 22:53:52 -0800
From:      Nerius Landys <nlandys@gmail.com>
To:        dg17@penx.com, FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Objective-C 2.0 on FreeBSD; garbage collection, anyone?
Message-ID:  <560f92641003102253t68d082a4x3d343521cced11ba@mail.gmail.com>
In-Reply-To: <1268263879.13552.1.camel@btw.pki2.com>
References:  <560f92641003100100y6490cf3veb53ca0b11a90dcb@mail.gmail.com> <1268263879.13552.1.camel@btw.pki2.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> What is the content of the header file?


File GarbageObj.h:
====================

#import <Foundation/Foundation.h>

@interface GarbageObj : NSObject {
}
-(void) foo;
@end



File GarbageObj.m:
====================

#import "GarbageObj.h"

@implementation GarbageObj

-(void) foo {
}
-(void) dealloc {
  //printf("dealloc\n");
  [super dealloc];
}
@end



File GarbageMain.m:
====================

#import "GarbageObj.h"

int main(int argc, const char *argv[]) {
  int inx = 0;
  while (YES) {
    inx++;
    GarbageObj *obj = [[GarbageObj alloc] init];
    [obj foo];
    if (inx == 1000000) {
      inx = 0;
      sleep(1);
    }
    //printf("before release\n");
    //[obj release];
    //printf("after release\n");
  }
  return 0;
}



File GNUmakefile:
====================

include $(GNUSTEP_MAKEFILES)/common.make

APP_NAME = garbagecollection
garbagecollection_HEADERS = GarbageObj.h
garbagecollection_OBJC_FILES = GarbageObj.m GarbageMain.m
garbagecollection_RESOURCE_FILES =
ADDITIONAL_OBJCFLAGS = -fobjc-gc

include $(GNUSTEP_MAKEFILES)/application.make



(I was building it as a "tool" before but now I tried "app" instead.
Same thing really.)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?560f92641003102253t68d082a4x3d343521cced11ba>