This question is for the java language in particular. I understand that there is a static protion of memory set aside for all static code.
My question is how is this
There is normally no such thing as "static" memory. Most vm's have the permanent generation of the heap (where classes get loaded), which is normally not garbage collected.
Static objects are allocated just like any other object. But, if they live for long they will be moved between the different generations in the garbage collector. But they will not end up in permgenspace.
If your class is holding onto this object permanently, it will only be released when the vm exits.