Chipmunk cp.spaceFree error processing arguments

Could anyone tell me why I am getting ‘error processing arguments’ error during execute of spaceFree method?
I use Cocos2dx JSB 2.2.3

My code:

space = new cp.Space();
space.gravity = cp.v(0, -800);
space.iterations = 30;
space.sleepTimeThreshold = Infinity;
space.collisionSlop = Infinity;

cp.spaceFree(space);

Kind regards

Bump.
I really need the answer ASAP. Can I use these functions in JSB? If not - how to remove physics object?

Why are you freeing the space there, or is this just a snippet?

Perhaps it gets garbage collected?

Try using

self.space = new cp.Space();
// ...
cp.spaceFree(self.space);

hello , i meet the same problem.could you tell me how to solve the problem?thank you very much!