EmbDev.net

Forum: FPGA, VHDL & Verilog Memory allocation problems in Modelsim


von JCB (jcbaraza)


Rate this post
useful
not useful
Hi all,

I've developed a tool that simulates a given VHDL model with different 
operation options, by changing some operation parameters. I run this 
tool using Modelsim (currently I'm using Modelsim 10.4 64 bits) as VHDL 
simulator. The idea of the tool is to launch vsim in background loading 
a model, and making it run a Tcl batch that repeatedly:

1. Launches a simulation.
2. Saves the simulation trace to a file (as a list, with "write list" 
command).
3. Restarts the simulator (with "restart -f" command).

I've been using this tool for years in multiple models and in different 
computers (with 8GB, 16GB and 32GB of RAM). But now I'm experiencing a 
memory problem when the Tcl macro runs the "restart -f" command:

# ** Warning: (vsim-8891) All optimizations are turned off because the 
-novopt switch is in effect. This will cause your simulation to run very 
slowly. If you are using this switch to preserve visibility for Debug or 
PLI features please see the User's Manual section on Preserving Object 
Visibility with vopt.
#
# ** Error: (vsim-3) System call VirtualAlloc() failed.
#
# El archivo de paginación es demasiado pequeño para completar la 
operación. (GetLastError() = 1455)
# ** Fatal: (vsim-4) ****** Memory allocation failure. *****
#
# Attempting to allocate 31426072 bytes
#
# Please check your system for available memory and swap space.
#
# ** Fatal: (vsim-4) ****** Memory allocation failure. *****
#
# Attempting to allocate 31426072 bytes
#
# Please check your system for available memory and swap space.
#
# ** Fatal: (vsim-4) ****** Memory allocation failure. *****
#
# Attempting to allocate 31360512 bytes
#
# Please check your system for available memory and swap space.
#
# ** Fatal: (vsim-4) ****** Memory allocation failure. *****
#
# Attempting to allocate 31360512 bytes
#
# Please check your system for available memory and swap space.
#

And vsim dies...

Note that:
* The problem does not occur always (that is, after every simulation), 
but after a number of simulations (about 400 in a particular computer).
* I've monitored the memory usage of the tool, and it doesn't seem to 
grow dramatically to make vsim die. In fact, I've never oberved to be 
near of the critical 4GB (it's usually between 1GB and 2GB).

I've seen in previous posts in this forum, and also in other forums, 
that one of the two errors ("** Error: (vsim-3) System call 
VirtualAlloc() failed" or "** Fatal: (vsim-4) ****** Memory allocation 
failure. *****") do appear during a model simulation, but not together, 
and not during a simulator restart.

Do you have any idea about what can be happening? As I explained above, 
I've got this error in computers with 8GB, 16GB and 32GB, so I don't 
think it is a memory problem with the computer. It seems to be a problem 
with memory management in Modelsim.

I'm trying to get a newer QuestaSim version, but meanwhile I'd like to 
know if this problem is known, and if it has a solution.

Regards,

von Vancouver (vancouver)


Rate this post
useful
not useful
As the problem occurs after a bunch of simulations, I could think of 
that the write buffers that keep the simulation traces are not actually 
written or released when a new simulation runs starts. I assume you are 
on Linux? Could you check how much memory space is reserved for buffers 
by the system? Not sure if there is a tcl command for flushing the write 
buffers.

von JCB (jcbaraza)


Rate this post
useful
not useful
Hi vancouver,

Thank you for your quick answer. No, I'm afraid I'm working under 
Windows 10, and the modelsim version is exactly Modelsim SE-64 10.4.

Well, I assume that the "restart -f" command clears all simulation 
buffers and memory, just keeping the display formats. Maybe I'm wrong, 
and I should force this clearance with another command? I've never seen 
so before, and as I mentionned in my first post, the tool has been 
working for many years with no need for additional buffer o data 
removal/flushing, or memory management...

Regarding checking the memory reservation for buffers, do you mean in 
the OS (in this case, Windows), or in Modelsim? At most, in Modelsim I 
could check the memory suage by writing a report...

Thanks again,

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.