[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Memory leaks problem in gnustep 0.8.5
From: |
Jan Trembulak |
Subject: |
Memory leaks problem in gnustep 0.8.5 |
Date: |
Thu, 15 May 2003 12:32:42 +0000 |
After numerous tests I have found out a problem with memory leaks in
gnustep - 0.8.5. (tested on Linux red hat 7.2, Solaris 8 ix86)
In the example I am enclosing, the application generates one window with
NSTextField item, and cyclically (by timer) redraws it.
After a few minutes it can be noticed that the application starts to
increase its memory, and after a few hours the size of memory will be
multiplied.
Thank you in advance for any help you can give me.
jan.
#import <AppKit/AppKit.h>
@interface AppController: NSObject
{
id aTxt;
NSTimer *aTmr;
NSButton *endB;
}
@end
@implementation AppController
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
id aWin = [[NSWindow alloc] initWithContentRect: NSMakeRect (0,0,130,50)
styleMask: NSTitledWindowMask
backing: NSBackingStoreBuffered
defer: YES];
[aWin setFrameOrigin: NSMakePoint(100,100)];
aTxt = [[NSTextField alloc] initWithFrame: NSMakeRect(5,5, 80, 25)];
[aTxt setStringValue: @"Mem test"];
endB = [[NSButton alloc] initWithFrame: NSMakeRect(90, 5,38,20)];
[endB setTarget: NSApp];
[endB setAction: @selector(terminate:)];
[endB setTitle: @"end"];
[[aWin contentView] addSubview: endB]; [endB release];
[[aWin contentView] addSubview: aTxt]; [aTxt release];
[aWin makeKeyAndOrderFront: nil];
aTmr = [NSTimer scheduledTimerWithTimeInterval: 0.01
target: self
selector: @selector(timerFire:)
userInfo: nil
repeats: YES];
[aTmr retain];
}
- (void) timerFire: (NSTimer *) aTmr
{
[aTxt setNeedsDisplay: YES];
// or
//[aTxt display];
}
@end
int main(int argc, const char *argv[]) {
id pool = [NSAutoreleasePool new];
id app;
app = [NSApplication sharedApplication];
[app setDelegate: [AppController new]];
[app run];
[pool release];
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Memory leaks problem in gnustep 0.8.5,
Jan Trembulak <=