diff --git a/samples/vboxwrapper/vbox.cpp b/samples/vboxwrapper/vbox.cpp
index 33f17a2f3efa5c368559ee2f12e35502480c3e40..ace42a8a1cbcd56c465d7aaec4cffdf583575d78 100644
--- a/samples/vboxwrapper/vbox.cpp
+++ b/samples/vboxwrapper/vbox.cpp
@@ -480,10 +480,10 @@ int VBOX_VM::create_vm() {
         stderr,
         "%s Setting Memory Size for VM. (%sMB)\n",
         vboxwrapper_msg_prefix(buf, sizeof(buf)),
-        memory_size_mb.c_str()
+        vm_memory_size_mb.c_str()
     );
     command  = "modifyvm \"" + vm_name + "\" ";
-    command += "--memory " + memory_size_mb + " ";
+    command += "--memory " + vm_memory_size_mb + " ";
 
     retval = vbm_popen(command, output, "modifymem");
     if (retval) return retval;
diff --git a/samples/vboxwrapper/vbox.h b/samples/vboxwrapper/vbox.h
index ac886259b9fdcb4c00e23bd34258618fe2472361..f40bd6e982d1ed6f23210310967e438b701b1ddd 100644
--- a/samples/vboxwrapper/vbox.h
+++ b/samples/vboxwrapper/vbox.h
@@ -92,8 +92,8 @@ public:
         // unique name for the VM or UUID of a stale VM if deregistering it
     std::string vm_cpu_count;
         // required CPU core count
-    std::string memory_size_mb;
-        // size of the memory allocation for the VM, in megabytes
+    std::string vm_memory_size_mb;
+        // required size of the memory allocation for the VM, in megabytes
     std::string image_filename;
         // name of the virtual machine disk image file
     std::string iso_image_filename;
@@ -132,6 +132,8 @@ public:
         // the type of disk controller to emulate
     std::string vm_disk_controller_model;
         // the disk controller model to emulate
+    double memory_size_mb;
+        // size of the memory allocation for the VM, in megabytes
     bool enable_cern_dataformat;
         // whether to use CERN specific data structures
     bool enable_isocontextualization;
diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp
index 3f82e2cbdb1acaa7965ad9a7c16573499ccce9fb..60cee6301c5ff2004e3162a656417189f64dcb8a 100644
--- a/samples/vboxwrapper/vboxwrapper.cpp
+++ b/samples/vboxwrapper/vboxwrapper.cpp
@@ -193,7 +193,7 @@ int parse_job_file(VBOX_VM& vm) {
         else if (xp.parse_string("vm_disk_controller_type", vm.vm_disk_controller_type)) continue;
         else if (xp.parse_string("vm_disk_controller_model", vm.vm_disk_controller_model)) continue;
         else if (xp.parse_string("os_name", vm.os_name)) continue;
-        else if (xp.parse_string("memory_size_mb", vm.memory_size_mb)) continue;
+        else if (xp.parse_double("memory_size_mb", vm.memory_size_mb)) continue;
         else if (xp.parse_double("job_duration", vm.job_duration)) continue;
         else if (xp.parse_double("minimum_checkpoint_interval", vm.minimum_checkpoint_interval)) continue;
         else if (xp.parse_string("fraction_done_filename", vm.fraction_done_filename)) continue;
@@ -514,6 +514,7 @@ int main(int argc, char** argv) {
     double bytes_sent = 0;
     double bytes_received = 0;
     double ncpus = 0;
+    double memory_size_mb = 0;
     double timeout = 0.0;
     bool report_net_usage = false;
     double net_usage_timer = 600;
@@ -527,9 +528,12 @@ int main(int argc, char** argv) {
         if (!strcmp(argv[i], "--trickle")) {
             trickle_period = atof(argv[++i]);
         }
-        if (!strcmp(argv[i], "--nthreads")) {
+        if (!strcmp(argv[i], "--ncpus")) {
             ncpus = atof(argv[++i]);
         }
+        if (!strcmp(argv[i], "--memory_size_mb")) {
+            memory_size_mb = atof(argv[++i]);
+        }
         if (!strcmp(argv[i], "--vmimage")) {
             vm_image = atoi(argv[++i]);
         }
@@ -831,7 +835,14 @@ int main(int argc, char** argv) {
     } else {
         vm.vm_cpu_count = "1";
     }
-
+    if (vm.memory_size_mb > 1.0 || memory_size_mb > 1.0) {
+        if (memory_size_mb) {
+            sprintf(buf, "%d", (int)ceil(memory_size_mb));
+        } else {
+            sprintf(buf, "%d", (int)ceil(vm.memory_size_mb));
+        }
+        vm.vm_memory_size_mb = buf;
+    }
     if (aid.vbox_window && !aid.using_sandbox) {
         vm.headless = false;
     }