How to limit RAM in an OSX device? [duplicate]












7
















This question already has an answer here:




  • Temporarily disabling RAM to mimic a lower spec machine?

    6 answers




Related to my other question, I'm about to buy a new Mac Mini. I would like to reduce RAM to 8GB in order to see if 8GB is enough to my daily tasks in my MBP retina 15 early 2013 16GB RAM.



The idea is I’ll let this mac not make use of any more RAM than 8 GB for the running applications to see if they swap to disk or run well with 8 GB of RAM.



Can I do this sort of artificial restriction on a mac that has RAM soldered or when it’s inconvenient to go physically remove RAM for testing purposes?










share|improve this question















marked as duplicate by Tetsujin, Allan macos
Users with the  macos badge can single-handedly close macos questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 29 at 0:38


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 2





    Now this is a great question. Since VM will make decisions differently as memory gets committed, you can’t just look at how much memory gets used on an older system and predict new. This question will get a bounty if we don’t get some good answers without one. @ me in comments if you don’t have any good answers in a week

    – bmike
    Jan 28 at 18:44
















7
















This question already has an answer here:




  • Temporarily disabling RAM to mimic a lower spec machine?

    6 answers




Related to my other question, I'm about to buy a new Mac Mini. I would like to reduce RAM to 8GB in order to see if 8GB is enough to my daily tasks in my MBP retina 15 early 2013 16GB RAM.



The idea is I’ll let this mac not make use of any more RAM than 8 GB for the running applications to see if they swap to disk or run well with 8 GB of RAM.



Can I do this sort of artificial restriction on a mac that has RAM soldered or when it’s inconvenient to go physically remove RAM for testing purposes?










share|improve this question















marked as duplicate by Tetsujin, Allan macos
Users with the  macos badge can single-handedly close macos questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 29 at 0:38


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 2





    Now this is a great question. Since VM will make decisions differently as memory gets committed, you can’t just look at how much memory gets used on an older system and predict new. This question will get a bounty if we don’t get some good answers without one. @ me in comments if you don’t have any good answers in a week

    – bmike
    Jan 28 at 18:44














7












7








7


1







This question already has an answer here:




  • Temporarily disabling RAM to mimic a lower spec machine?

    6 answers




Related to my other question, I'm about to buy a new Mac Mini. I would like to reduce RAM to 8GB in order to see if 8GB is enough to my daily tasks in my MBP retina 15 early 2013 16GB RAM.



The idea is I’ll let this mac not make use of any more RAM than 8 GB for the running applications to see if they swap to disk or run well with 8 GB of RAM.



Can I do this sort of artificial restriction on a mac that has RAM soldered or when it’s inconvenient to go physically remove RAM for testing purposes?










share|improve this question

















This question already has an answer here:




  • Temporarily disabling RAM to mimic a lower spec machine?

    6 answers




Related to my other question, I'm about to buy a new Mac Mini. I would like to reduce RAM to 8GB in order to see if 8GB is enough to my daily tasks in my MBP retina 15 early 2013 16GB RAM.



The idea is I’ll let this mac not make use of any more RAM than 8 GB for the running applications to see if they swap to disk or run well with 8 GB of RAM.



Can I do this sort of artificial restriction on a mac that has RAM soldered or when it’s inconvenient to go physically remove RAM for testing purposes?





This question already has an answer here:




  • Temporarily disabling RAM to mimic a lower spec machine?

    6 answers








macos macbook memory mac-mini performance






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 28 at 18:47









bmike

159k46285620




159k46285620










asked Jan 28 at 18:37









biotechbiotech

328213




328213




marked as duplicate by Tetsujin, Allan macos
Users with the  macos badge can single-handedly close macos questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 29 at 0:38


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Tetsujin, Allan macos
Users with the  macos badge can single-handedly close macos questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 29 at 0:38


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 2





    Now this is a great question. Since VM will make decisions differently as memory gets committed, you can’t just look at how much memory gets used on an older system and predict new. This question will get a bounty if we don’t get some good answers without one. @ me in comments if you don’t have any good answers in a week

    – bmike
    Jan 28 at 18:44














  • 2





    Now this is a great question. Since VM will make decisions differently as memory gets committed, you can’t just look at how much memory gets used on an older system and predict new. This question will get a bounty if we don’t get some good answers without one. @ me in comments if you don’t have any good answers in a week

    – bmike
    Jan 28 at 18:44








2




2





Now this is a great question. Since VM will make decisions differently as memory gets committed, you can’t just look at how much memory gets used on an older system and predict new. This question will get a bounty if we don’t get some good answers without one. @ me in comments if you don’t have any good answers in a week

– bmike
Jan 28 at 18:44





Now this is a great question. Since VM will make decisions differently as memory gets committed, you can’t just look at how much memory gets used on an older system and predict new. This question will get a bounty if we don’t get some good answers without one. @ me in comments if you don’t have any good answers in a week

– bmike
Jan 28 at 18:44










1 Answer
1






active

oldest

votes


















10














Create a ram disk :-)



From the answer to Mount a RAM disk on boot:




You can create and mount a RAM disk with the following Terminal (i.e. shell) command:



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://2048)


Where 2048 can be any number and represents the number of 512 byte blocks you want to allocate. So 1,000,000 will get you 512,000,000 bytes. (Of course, you have to leave out the commas.)




So in your case the command would be



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://$((8*2**30/512)))





share|improve this answer


























  • I was thinking of a virtual machine but this is much simpler :)

    – Thorbjørn Ravn Andersen
    Jan 28 at 18:50











  • 😭for the 8 times 2^30 divided by 512 - that's awesome and a little harder to recognize at glance than our old friend 16777216

    – bmike
    Jan 28 at 20:14











  • I was tongue in cheek - I love that you build up the exact request using math. : - ) It teaches several items where just dumping the number is correct, but not illuminating. Also, that operator order of precedence works is so cool, too.

    – bmike
    Jan 28 at 20:21








  • 1





    FWIW I keep a 2 GiB RAM disk and when first created diskimages-helper, which manages the RAM disk after being created by diskutil, is only ~33 MB and will grow as the RAM disk is filled up to the 2 GiB size. I think for an accurate test the RAM disk needs to be filled as it's not all used until it is. I'd use e.g. cat /dev/zero > /Volumes/diskName/foobar to have the designated amount of RAM actually used by the RAM disk... Otherwise I believe what is not used on the RAM disk size allotment is still available to the system. I could be wrong but that's my observation with this scenario.

    – user3439894
    Jan 28 at 20:35








  • 4





    Would the ramdisk ever swap?

    – Freiheit
    Jan 28 at 20:40


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









10














Create a ram disk :-)



From the answer to Mount a RAM disk on boot:




You can create and mount a RAM disk with the following Terminal (i.e. shell) command:



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://2048)


Where 2048 can be any number and represents the number of 512 byte blocks you want to allocate. So 1,000,000 will get you 512,000,000 bytes. (Of course, you have to leave out the commas.)




So in your case the command would be



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://$((8*2**30/512)))





share|improve this answer


























  • I was thinking of a virtual machine but this is much simpler :)

    – Thorbjørn Ravn Andersen
    Jan 28 at 18:50











  • 😭for the 8 times 2^30 divided by 512 - that's awesome and a little harder to recognize at glance than our old friend 16777216

    – bmike
    Jan 28 at 20:14











  • I was tongue in cheek - I love that you build up the exact request using math. : - ) It teaches several items where just dumping the number is correct, but not illuminating. Also, that operator order of precedence works is so cool, too.

    – bmike
    Jan 28 at 20:21








  • 1





    FWIW I keep a 2 GiB RAM disk and when first created diskimages-helper, which manages the RAM disk after being created by diskutil, is only ~33 MB and will grow as the RAM disk is filled up to the 2 GiB size. I think for an accurate test the RAM disk needs to be filled as it's not all used until it is. I'd use e.g. cat /dev/zero > /Volumes/diskName/foobar to have the designated amount of RAM actually used by the RAM disk... Otherwise I believe what is not used on the RAM disk size allotment is still available to the system. I could be wrong but that's my observation with this scenario.

    – user3439894
    Jan 28 at 20:35








  • 4





    Would the ramdisk ever swap?

    – Freiheit
    Jan 28 at 20:40
















10














Create a ram disk :-)



From the answer to Mount a RAM disk on boot:




You can create and mount a RAM disk with the following Terminal (i.e. shell) command:



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://2048)


Where 2048 can be any number and represents the number of 512 byte blocks you want to allocate. So 1,000,000 will get you 512,000,000 bytes. (Of course, you have to leave out the commas.)




So in your case the command would be



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://$((8*2**30/512)))





share|improve this answer


























  • I was thinking of a virtual machine but this is much simpler :)

    – Thorbjørn Ravn Andersen
    Jan 28 at 18:50











  • 😭for the 8 times 2^30 divided by 512 - that's awesome and a little harder to recognize at glance than our old friend 16777216

    – bmike
    Jan 28 at 20:14











  • I was tongue in cheek - I love that you build up the exact request using math. : - ) It teaches several items where just dumping the number is correct, but not illuminating. Also, that operator order of precedence works is so cool, too.

    – bmike
    Jan 28 at 20:21








  • 1





    FWIW I keep a 2 GiB RAM disk and when first created diskimages-helper, which manages the RAM disk after being created by diskutil, is only ~33 MB and will grow as the RAM disk is filled up to the 2 GiB size. I think for an accurate test the RAM disk needs to be filled as it's not all used until it is. I'd use e.g. cat /dev/zero > /Volumes/diskName/foobar to have the designated amount of RAM actually used by the RAM disk... Otherwise I believe what is not used on the RAM disk size allotment is still available to the system. I could be wrong but that's my observation with this scenario.

    – user3439894
    Jan 28 at 20:35








  • 4





    Would the ramdisk ever swap?

    – Freiheit
    Jan 28 at 20:40














10












10








10







Create a ram disk :-)



From the answer to Mount a RAM disk on boot:




You can create and mount a RAM disk with the following Terminal (i.e. shell) command:



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://2048)


Where 2048 can be any number and represents the number of 512 byte blocks you want to allocate. So 1,000,000 will get you 512,000,000 bytes. (Of course, you have to leave out the commas.)




So in your case the command would be



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://$((8*2**30/512)))





share|improve this answer















Create a ram disk :-)



From the answer to Mount a RAM disk on boot:




You can create and mount a RAM disk with the following Terminal (i.e. shell) command:



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://2048)


Where 2048 can be any number and represents the number of 512 byte blocks you want to allocate. So 1,000,000 will get you 512,000,000 bytes. (Of course, you have to leave out the commas.)




So in your case the command would be



diskutil erasevolume HFS+ "diskName" $(hdiutil attach -nomount ram://$((8*2**30/512)))






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 28 at 19:51

























answered Jan 28 at 18:43









nohillsidenohillside

52.2k13111154




52.2k13111154













  • I was thinking of a virtual machine but this is much simpler :)

    – Thorbjørn Ravn Andersen
    Jan 28 at 18:50











  • 😭for the 8 times 2^30 divided by 512 - that's awesome and a little harder to recognize at glance than our old friend 16777216

    – bmike
    Jan 28 at 20:14











  • I was tongue in cheek - I love that you build up the exact request using math. : - ) It teaches several items where just dumping the number is correct, but not illuminating. Also, that operator order of precedence works is so cool, too.

    – bmike
    Jan 28 at 20:21








  • 1





    FWIW I keep a 2 GiB RAM disk and when first created diskimages-helper, which manages the RAM disk after being created by diskutil, is only ~33 MB and will grow as the RAM disk is filled up to the 2 GiB size. I think for an accurate test the RAM disk needs to be filled as it's not all used until it is. I'd use e.g. cat /dev/zero > /Volumes/diskName/foobar to have the designated amount of RAM actually used by the RAM disk... Otherwise I believe what is not used on the RAM disk size allotment is still available to the system. I could be wrong but that's my observation with this scenario.

    – user3439894
    Jan 28 at 20:35








  • 4





    Would the ramdisk ever swap?

    – Freiheit
    Jan 28 at 20:40



















  • I was thinking of a virtual machine but this is much simpler :)

    – Thorbjørn Ravn Andersen
    Jan 28 at 18:50











  • 😭for the 8 times 2^30 divided by 512 - that's awesome and a little harder to recognize at glance than our old friend 16777216

    – bmike
    Jan 28 at 20:14











  • I was tongue in cheek - I love that you build up the exact request using math. : - ) It teaches several items where just dumping the number is correct, but not illuminating. Also, that operator order of precedence works is so cool, too.

    – bmike
    Jan 28 at 20:21








  • 1





    FWIW I keep a 2 GiB RAM disk and when first created diskimages-helper, which manages the RAM disk after being created by diskutil, is only ~33 MB and will grow as the RAM disk is filled up to the 2 GiB size. I think for an accurate test the RAM disk needs to be filled as it's not all used until it is. I'd use e.g. cat /dev/zero > /Volumes/diskName/foobar to have the designated amount of RAM actually used by the RAM disk... Otherwise I believe what is not used on the RAM disk size allotment is still available to the system. I could be wrong but that's my observation with this scenario.

    – user3439894
    Jan 28 at 20:35








  • 4





    Would the ramdisk ever swap?

    – Freiheit
    Jan 28 at 20:40

















I was thinking of a virtual machine but this is much simpler :)

– Thorbjørn Ravn Andersen
Jan 28 at 18:50





I was thinking of a virtual machine but this is much simpler :)

– Thorbjørn Ravn Andersen
Jan 28 at 18:50













😭for the 8 times 2^30 divided by 512 - that's awesome and a little harder to recognize at glance than our old friend 16777216

– bmike
Jan 28 at 20:14





😭for the 8 times 2^30 divided by 512 - that's awesome and a little harder to recognize at glance than our old friend 16777216

– bmike
Jan 28 at 20:14













I was tongue in cheek - I love that you build up the exact request using math. : - ) It teaches several items where just dumping the number is correct, but not illuminating. Also, that operator order of precedence works is so cool, too.

– bmike
Jan 28 at 20:21







I was tongue in cheek - I love that you build up the exact request using math. : - ) It teaches several items where just dumping the number is correct, but not illuminating. Also, that operator order of precedence works is so cool, too.

– bmike
Jan 28 at 20:21






1




1





FWIW I keep a 2 GiB RAM disk and when first created diskimages-helper, which manages the RAM disk after being created by diskutil, is only ~33 MB and will grow as the RAM disk is filled up to the 2 GiB size. I think for an accurate test the RAM disk needs to be filled as it's not all used until it is. I'd use e.g. cat /dev/zero > /Volumes/diskName/foobar to have the designated amount of RAM actually used by the RAM disk... Otherwise I believe what is not used on the RAM disk size allotment is still available to the system. I could be wrong but that's my observation with this scenario.

– user3439894
Jan 28 at 20:35







FWIW I keep a 2 GiB RAM disk and when first created diskimages-helper, which manages the RAM disk after being created by diskutil, is only ~33 MB and will grow as the RAM disk is filled up to the 2 GiB size. I think for an accurate test the RAM disk needs to be filled as it's not all used until it is. I'd use e.g. cat /dev/zero > /Volumes/diskName/foobar to have the designated amount of RAM actually used by the RAM disk... Otherwise I believe what is not used on the RAM disk size allotment is still available to the system. I could be wrong but that's my observation with this scenario.

– user3439894
Jan 28 at 20:35






4




4





Would the ramdisk ever swap?

– Freiheit
Jan 28 at 20:40





Would the ramdisk ever swap?

– Freiheit
Jan 28 at 20:40



Popular posts from this blog

How do I know what Microsoft account the skydrive app is syncing to?

When does type information flow backwards in C++?

Grease: Live!