Hi,
I am seeing some unexpected behaviour and was hoping someone might be able
to shed some light on this.
I have a basic Counter class. The relevant methods for the problem are:
-init
{
if (self = [super init]) {
//counter = [[NSNumber alloc] init];
counter = [NSNumber numberWithInt:0]; //
I think I have found the answer to your question; when executing the
following code, I get a few strange results...
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSNumber *n0 = [NSNumber numberWithInt:1];
NSLog(@n0: %d, [n0 retainCount]);
[n0 release];
NSLog(@n0: %d, [n0
On Dec 14, 2008, at 10:55 AM, Krishna Kotecha wrote:
-(void) dealloc
{
[counter release];
[super dealloc];
}
Guess what I overlooked? My apologies; Flip is probably correct.
Nick Zitzmann
http://www.chronosnet.com/
___
Cocoa-dev mailing list
Le 14 déc. 08 à 22:36, Filip van der Meeren a écrit :
I think I have found the answer to your question; when executing the
following code, I get a few strange results...
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSNumber *n0 = [NSNumber numberWithInt:1];
NSLog(@n0: %d,
Thank you, I was just replying to your mail ;-)
Filip van der Meeren
fi...@code2develop.com
http://www.sourceforge.net/projects/perlmanager
http://www.sourceforge.net/projects/xlinterpreter
On 14 Dec 2008, at 22:49, Nick Zitzmann wrote:
On Dec 14, 2008, at 10:55 AM, Krishna Kotecha wrote:
If you allocate the object yourself, like the following:
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSNumber *n = nil;
NSInteger wh = 0;
srand(time(NULL));
for(int i = 0; i 100 * 1000; ++i)
{
n = [[NSNumber alloc] initWithInt:rand()];
if([n retainCount])
On Dec 14, 2008, at 4:01 PM, Filip van der Meeren wrote:
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSNumber *n = nil;
NSInteger wh = 0;
srand(time(NULL));
for(int i = 0; i 100 * 1000; ++i)
{
n = [[NSNumber alloc] initWithInt:rand()];
if([n retainCount])
I suggest you run my code, on your system.
Do not start up leaks, start up Activity Monitor and watch your memory
closely.
If your system doesn't crash/hangs before you can stop it, then you
will see that the app is consuming memory like the Americans are
consuming oil.
And according to me,
On Dec 14, 2008, at 4:17 PM, Filip van der Meeren wrote:
If your system doesn't crash/hangs before you can stop it, then you
will see that the app is consuming memory like the Americans are
consuming oil.
And according to me, my program respects the Memory Management
rules. So I say there
On 14 Dec 2008, at 23:27, Ken Thomases wrote:
On Dec 14, 2008, at 4:17 PM, Filip van der Meeren wrote:
If your system doesn't crash/hangs before you can stop it, then you
will see that the app is consuming memory like the Americans are
consuming oil.
And according to me, my program
On 14 Dec 2008, at 23:27, Ken Thomases wrote:
On Dec 14, 2008, at 4:17 PM, Filip van der Meeren wrote:
If your system doesn't crash/hangs before you can stop it, then you
will see that the app is consuming memory like the Americans are
consuming oil.
And according to me, my program
On Dec 14, 2008, at 4:38 PM, Filip van der Meeren wrote:
[...] NSNumber is the basic foundation of our OS, I know dozens of
ways to create the object without autoreleasing it inside somewhere.
Really? Since you're invoking closed-source framework code, it's hard
to imagine how you can
Hi,
Just wanted to thank everyone who responded to my question.
I'm trying to get the memory management stuff down cold, hence I was
breaking the memory management rules in my Counter class and was perplexed
by the results I got.
The explanations here have certainly helped increase my
On 14 Dec 2008, at 23:57, Ken Thomases wrote:
On Dec 14, 2008, at 4:38 PM, Filip van der Meeren wrote:
[...] NSNumber is the basic foundation of our OS, I know dozens of
ways to create the object without autoreleasing it inside somewhere.
Really? Since you're invoking closed-source
On Sun, Dec 14, 2008 at 12:55 PM, Krishna Kotecha
krishna.kote...@gmail.com wrote:
Shouldn't this code be causing an error at some point? And if not, why not?
Any insights or explanations any one has on this would be appreciated.
All C programmers (and therefore all Objective-C programmers)
On Sun, Dec 14, 2008 at 5:38 PM, Filip van der Meeren
fi...@code2develop.com wrote:
On 14 Dec 2008, at 23:27, Ken Thomases wrote:
On Dec 14, 2008, at 4:17 PM, Filip van der Meeren wrote:
If your system doesn't crash/hangs before you can stop it, then you will
see that the app is consuming
On 15 Dec 2008, at 00:09, Michael Ash wrote:
On Sun, Dec 14, 2008 at 12:55 PM, Krishna Kotecha
krishna.kote...@gmail.com wrote:
Shouldn't this code be causing an error at some point? And if not,
why not?
Any insights or explanations any one has on this would be
appreciated.
All C
17 matches
Mail list logo