For a project, I want to incrementally load the RAM of my VxWorks 7 system to test its performance under this stress. How can I do that?
I have tried a c-Script :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void memoryIntensiveFunction() {
size_t size = 100 * 1024 * 1024;
char *largeMemoryBlock = (char *)malloc(size);
if (largeMemoryBlock == NULL) {
perror("Speicherzuweisung fehlgeschlagen");
return;
}
for (size_t i = 0; i < size; i++) {
largeMemoryBlock[i] = (char)(i % 256);
if (i % (1024 * 1024) == 0) { // Jedes MB einmal lesen
volatile char temp = largeMemoryBlock[i];
}
}
sleep(1800);
}
int main() {
memoryIntensiveFunction();
return 0;
}
used:memset(); malloc(). But there is no memory allocated. Atleast memShow does not show any difference. I am struggling a bit with understanding all the specific memory terms.