how can a implement the my code to be loaded dynamically when ever required by the application and unload it when its work is over. Is this possible on iphone if so how can we implement it.
AFAIK, the only way to unload code is to unload a bundle which would contain the code you want to run. But the iPhone SDK doesn't support bundles/frameworks, so I don't think it's possible.
It's also probably a pointless thing to worry about unless you have some super memory hog code, which probably doesn't belong on the iPhone to begin with.