how do you write a program that uses all of the RAM in your computer? eny examples in C or Python would be nice. just a big malloc()?
>>54586825
while (1) malloc(1):
Use a fork bomb, the old ways never die.
>>54586825
Your OS will most likely kill it after a certain point
It's called Chrome.
>>54586825
I don't have the sources code but check out this program called Windows
>>54586867
kek
>>54586825
if i have X GB or memory, how do i programmatically (C, Python, Assembler) say: grab X GB of RAM?
>>54586990
or rather N GB (where N <X)
make a runnable file with content "./filename"
run it
>>54586990
C:char *ptr;
ptr = malloc (4294967296 * sizeof (char));
>>54586874
Actually kekd
>>54587025
That's pretty basic.
I think OP is asking how he'd do it dynamically.
Also interested, bump
>>54587120
Then fuck off to ylyl
Use calloc it'll set it all to zero so that you won't have to bother with memset.
>>54587139
no, statically :) but dynamically would also be nice.
op
>>54587025
does it only work up to 4 GB?
i assume sizeof(char) is one byte
seriously, like:(){:|:&};:
>>54587288
That'll give you a syntax error
>>54587481
nice try
>>54587515
It's true. Your whitespace is wrong.
>>54587565
when the fuck has whitespace ever mattered in bash in this context?
even with only 2gb of ram ive never really used it all
firefox uses like 500mb max, all my games are old as shit and some use double digit amounts of ram, most intensive thing ive ever done to get close to all 2gb was halo 2
>>54587594
Have you never defined a function in bash?
>>54586874
Underrated post
>>54587288
>tfw it doesn't work
>>54586825#include<stdio.h>
#include<stdlib.h>
int main(){
int i=1;
while(1)
{
int * a = malloc(sizeof(char)*1024*1024);
if(!a) {break;}
else{
printf("%dMB allocated\n",i);
i++;
}
}
return 0;
}
>>54586874
goodlord
>>54586825
You'll "use up" all the ram with any malloc call or loading in a file that is 8 gigabytes big, but modern day operating systems are intelligent and will just page it so it doesn't affect other processes.
>>54586874
>>54586880
lmao
>>54587025
>sizeof (char)
According to section 6.5.3.4 constraint 4 of ISO 9899, you're a fucking retard.
>>54586825
`yes`
your welcome.
>>54589400
according to constraint 3, you're in over your head
>>54589400
>using ~20 year old standards
>>54586843
>>54587025
>>54589054
Overcommit.
>>54586843
while(malloc(1));
>>54589505
according to n1570 he's still a retard
>>54591244
strictly speaking, that _will_ work, just not for the reason he thinks.
>>54589054
thx
if i add another printf to print the return value of malloc()
printf("%p foobar\n",a);
how do i interpret the address it returns? for example:
1065MB allocated
0x747fc008 foobar
>>54586867
Fork bombs don't usually fill your ram
>>54586825
I'm pretty sure you can't do that if you're using an operating system like Windows or Linux.
Why do you think memtest86 is it's own operating system.
>>54586874
topkek
You deserve it if you run chrome.