changed resman and map to allocate their own memory