LaymanBrian
LaymanBrian

Reputation: 1

gem5 connecting 2 memory devices not work

I'm trying to simulate a hybrid memory controller in gem5, and when i connect the 2 memory devices to the membus, it seems only 1 memory device is recognized. When i run a c program that malloc space more than 1MB, i get error like this

build/X86/sim/mem_pool.cc:120: fatal: fatal condition freePages() <= 0 occurred: Out of memory, please increase size of physical memory'

the memory ranges is [AddrRange('1MB'), AddrRange('1MB', '8MB')], after i changed the first to be 8MB, the program runs ok. my gem5 version is v22.1.0.0

I tried to change the getAddrRanges function, returning only one AddrRange that is the total memory range, it doesn't work. I changed the c program from using static global array to using malloc to dynamic allocate memory, it doesn't work.

Upvotes: 0

Views: 257

Answers (2)

Prefetcher Shatnawi
Prefetcher Shatnawi

Reputation: 98

If your C code consumes exactly 1MB, it doesn’t mean that you will need exactly 1MB memory capacity. I wonder why would you use a memory that have a an exact size of your allocated memory in the C code. The error says that more than 1MB is needed that’s why changing it to >1MB fixed the issue. Think of it this way, you have an architecture with a memory hold data for multiple processes and the remaining free space is not enough to run extra programs.

Upvotes: 0

Prefetcher Shatnawi
Prefetcher Shatnawi

Reputation: 98

Your result is so expected. The error being thrown is due to the memory size. Running a c program that allocates exactly 1MB of data + your code being loaded and executed will need >1MB. This will fail your program to run. I don’t see any valid reason not to increase your memory range. Please consider either removing your question or try to learn more about simulations.

Upvotes: 0

Related Questions