A method and apparatus for adaptive garbage collection in dynamic memory
allocation. The method includes allocating a portion of a first memory
space to a new object in response to a request from a predetermined
process, copying objects used by the predetermined process among all
objects occupying the first memory space to a second memory space, and
adjusting the size of the first memory space and the size of the second
memory space according to predetermined information.