Java native agent for memory management