added memory size detection code