memory
UWP Windows 10 App memory increasing on navigation
Every time you navigate to a Page, you create a new instance of Page, but the previous Page is not disposed (even if the Page is already in the navigation stack). To prevent multiple allocation of same page, set NavigationCacheMode=”Enabled” attribute to the Page. Also, to minimize the memory allocation, you must override method OnNavigatedTo … Read more
How to benchmark memory usage of a function?
You can use the jemalloc allocator to print the allocation statistics. For example, Cargo.toml: [package] name = “stackoverflow-30869007” version = “0.1.0” edition = “2018” [dependencies] jemallocator = “0.5” jemalloc-sys = {version = “0.5”, features = [“stats”]} libc = “0.2” src/main.rs: use libc::{c_char, c_void}; use std::ptr::{null, null_mut}; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; extern “C” fn … Read more
Python: How to read huge text file into memory
There is a recipe for sorting files larger than RAM on this page, though you’d have to adapt it for your case involving CSV-format data. There are also links to additional resources there. Edit: True, the file on disk is not “larger than RAM”, but the in-memory representation can easily become much larger than available … Read more
What is the best way to prevent out of memory (OOM) freezes on Linux?
Below is a really basic perl script I wrote. With a bit of tweaking it could be useful. You just need to change the paths I have to the paths of any processes that use Java or C#. You could change the kill commands I’ve used to restart commands also. Of course to avoid typing … Read more
Python memory consumption: dict VS list of tuples
Your list of tuples adds an extra layer. You have 3 layers of items: The outer list of length 1 million, so 1 million pointers 1 million 2-slot tuples, so 2 million pointers 2 million references to 1 million integer values while your dict only holds: The dict (including 1 million cached hashes) with 2 … Read more
Rounding Errors?
It is true. It is an inherent limitation of how floating point values are represented in memory in a finite number of bits. This program, for instance, prints “false”: public class Main { public static void main(String[] args) { double a = 0.7; double b = 0.9; double x = a + 0.1; double y … Read more
Is my understanding of AoS vs SoA advantages/disadvantages correct?
“traversing” just means looping over the data. And yes, you’re right about cache ways and collisions. 64B (cache line size) blocks of memory that are offset from each other by a large power of 2 map to the same set, and thus compete with each other for ways in that set, instead of being cached … Read more
java.lang.OutOfMemoryError: Java heap space in DBeaver [duplicate]
I encountered same issue: every time you get it, you have to allocate more space and run DBeaver itself first with additional flags -vmargs -Xmx*m. Replace * with 2048 or 4096. It doesn’t look like DBeaver takes garbage out when closing the script, so I had to restart application many times to check right amount … Read more
Is stack in CPU or RAM?
Stack is always in RAM. There is a stack pointer that is kept in a register in CPU that points to the top of stack, i.e., the address of the location at the top of stack.