@clarus @slembcke @andrew . i thank you all for the help you are providing.
Now i have some member variables like so
cpShape *redmarble;
cpCCSprite *redmarbleSprite;
i am assigning shapes and sprites like so,
redmarble = [smgr addCircleAt:cpv(xredpos,yredpos) mass:0.5 radius:18];
redmarble->collision_type = KMarbleCollisiontype;
redmarbleSprite= [cpCCSprite spriteWithShape:redmarble file:@"redmar.png"];
redmarble->e = 0.5;
[self addChild:redmarbleSprite];
redmarbleSprite.spaceManager = smgr;
i have a schedular that keeps checking the velocity of the horizontal velocity of the ball. if it is near zero i make the ball disappear. And that is the only place i ever remove the ball from the space. And here is the code for that.
-(void)checkifREDsleeping
{
cpVect velocity = redmarble->body->v;
NSLog(@" RED velocity X,Y is %f,%f",velocity.x,velocity.y);
if (REDselected ==YES && velocity.y == 0.0)
{
if ([GameDelegate getvolumestatus]==@"1")
{
[[SimpleAudioEngine sharedEngine] playEffect:@"Sound 1a.mp3"];
}
[smgr removeShape:redmarble];
[self removeChild:redmarbleSprite cleanup:YES];
[self unschedule: @selector(checkifREDsleeping)];
REDdisappeared = YES;
}
}
i have tested my app in instruments and surprisingly it shows leaks in cpCircleShapeAlloc. not sure why? Here is the screenshot.

This is how i am replacing a scene
-(void)Next
{
CCScene *game = [CCScene node];
Level2 *gamel = [Level2 node];
[game addChild:gamel z:0 tag:0];
NSLog(@"replacing scene");
[[CCDirector sharedDirector] replaceScene:[CCTransitionMoveInR transitionWithDuration:0.5 scene:game]];
[[CCDirector sharedDirector] resume];
}
and here is my dealloc
- (void) dealloc
{
NSLog(@"i am inside delloc - level one");
[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
[self removeAllChildrenWithCleanup:YES];
[smgr release];
[super dealloc];
}
wheneever i replace a scene i have a NSLog statement in dealloc. i am 100% sure that it executes the dealloc whenever replace scene is called. here is the screenshot for that.

UPDATE : Sorry i could not get the images uploaded.