You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any recommendation, preferred examples, or documentation for managing dynamic memory allocation during simulation? I see some of the ROSS_models seem to use tw_calloc(), but I haven't found any description about its specific purpose or usage. Thanks!
The text was updated successfully, but these errors were encountered:
I don't think there's any documentation on that yet. Documentation is something I've been trying to work on as I get some time, but there's still a lot to do.
Basically we typically recommend not to use dynamically allocated memory, if you're using optimistic mode at all. In general, dynamic allocations can be slower, so that's why we pre-allocate our event buffers in ROSS during init. But for optimistic mode, you run into the additional problem of having to carefully choose when to free memory, because you need things to hang around in case of rollbacks. There's also technically a potential for any non-reversible library calls to cause issues in optimistic simulators, though I'm unsure how likely that is.
tw_calloc() is recommended over using actual dynamically created memory. This call will pull the memory from a memory pool. But there is no associated tw_free(), so you'd be responsible for figuring out how to manage the memory you get from the memory pool.
Any recommendation, preferred examples, or documentation for managing dynamic memory allocation during simulation? I see some of the ROSS_models seem to use tw_calloc(), but I haven't found any description about its specific purpose or usage. Thanks!
The text was updated successfully, but these errors were encountered: