Well Srinivas,
You should first check the size of your pictures, usually they should be pretty small but sometimes if you compress them incorrectly they will be too big.
Also, you should make sure you are using a custom adapter to create the gallery, that way you don't have to hold all the information of all the pictures in one go. A good example of this that is http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html.
Though its not a gallery, its really easy to adapt into a gallery.
Finally, you should really use the search function. http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue/823966#823966