memory-management

GetRef's memory consumption (garbage collection) changed with KB4525236

荒凉一梦 提交于 2020-06-24 22:01:10
问题 We experience out-of-memory issues after installing KB4525236 on our Windows 2016 Servers/Windows 10 Clients. This security fix seems to have changed the moment when memory is garbage collected when calling a function through GetRef . Pré KB4525236 Each instance created in a function called through GetRef got garbage collected as soon as the instance variable was set to nothing Post KB4525236 Each instance created in a function called through GetRef remains in memory and is garbage collected

Linux OS: /proc/[pid]/smaps vs /proc/[pid]/statm

倾然丶 夕夏残阳落幕 提交于 2020-06-24 09:51:12
问题 I would like calculate the memory usage for single process. So after a little bit of research I came across over smaps and statm. First of all what is smaps and statm? What is the difference? statm has a field RSS and in smaps I sum up all RSS values. But those values are different for the same process. I know that statm measures in pages. For comparison purposes I converted that value in kb as in smaps. But those values are not equal. Why do these two values differ, even though they

Is it good coding practice to assign the address returned by realloc() to the same pointer?

谁说胖子不能爱 提交于 2020-06-23 04:18:24
问题 I saw some code related to realloc() on some sites as below. int *p = (int *)malloc(sizeof(int) * 10); p = (int *)realloc(p, 100); But as the standard says, if realloc fails, the original block is left untouched and it returns NULL. So if realloc fails, from above example, we will lose the ability to free p. Can any one please let me know is it good coding practice to assign the address returned by realloc() to the same pointer? 回答1: You are correct that directly assigning the return value of

Determining page numbers and offsets for given addresses

两盒软妹~` 提交于 2020-06-22 11:41:05
问题 Consider a computer system with a 32-bit logical address and 4KB page size. The system supports up to 512MB of physical memory. How many entries are there in a conventional single-level page table? Conventional single-level page table: 2^32 / 2^12 (4000) = 2^20 = 1,048,576 Why did I have to divide 2^32 / 2^12 to get the answer? How many entries are there in an inverted page table? An inverted page table needs as many entries as there are page frames in memory. Inverted page table: 2^29 (512mb

When would the python tracemalloc module allocations statistics not match what's shown in ps or pmap?

二次信任 提交于 2020-06-14 04:57:08
问题 I'm trying to track down a memory leak, so I've done import tracemalloc tracemalloc.start() <function call> # copy pasted this from documentation snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") for stat in top_stats[:10]: print(stat) This shows no major allocations, all memory allocations are pretty small, while I'm seeing 8+ GB memory allocated in ps and pmap (checking before and after running the command, and after running garbage

When would the python tracemalloc module allocations statistics not match what's shown in ps or pmap?

﹥>﹥吖頭↗ 提交于 2020-06-14 04:56:30
问题 I'm trying to track down a memory leak, so I've done import tracemalloc tracemalloc.start() <function call> # copy pasted this from documentation snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") for stat in top_stats[:10]: print(stat) This shows no major allocations, all memory allocations are pretty small, while I'm seeing 8+ GB memory allocated in ps and pmap (checking before and after running the command, and after running garbage

Why is there no 'aligned_realloc' on most platforms?

江枫思渺然 提交于 2020-06-12 04:42:23
问题 MSVC has its own non-standard functions _aligned_malloc , _aligned_realloc and _aligned_free . C++17 and C11 have introduced (std::)aligned_alloc , results of which can be de allocated with free or realloc . But realloc cannot be used to actually re allocate memory returned by aligned_alloc , since it does not take an alignment parameter and thus cannot guarantee that the returned pointer will be properly aligned. I can't even find any non-standard extensions that could reallocate aligned

Why is there no 'aligned_realloc' on most platforms?

我们两清 提交于 2020-06-12 04:41:56
问题 MSVC has its own non-standard functions _aligned_malloc , _aligned_realloc and _aligned_free . C++17 and C11 have introduced (std::)aligned_alloc , results of which can be de allocated with free or realloc . But realloc cannot be used to actually re allocate memory returned by aligned_alloc , since it does not take an alignment parameter and thus cannot guarantee that the returned pointer will be properly aligned. I can't even find any non-standard extensions that could reallocate aligned

Why is the return value of malloc(0) implementation-defined?

China☆狼群 提交于 2020-06-10 07:33:07
问题 ISO/IEC 9899:TC2 (i.e. the C99 standard), §7.20.3 states: If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object. In other words, malloc(0) may either return NULL or a valid pointer which I may not dereference. What is the rationale behind this behavior? And wouldn't it be easier to just define that

kubernetes pod memory - java gc logs

安稳与你 提交于 2020-06-09 18:42:09
问题 On the kubernetes dashboard, there's a pod wherein the Memory Usage (bytes) is displayed as 904.38Mi . This pod holds the java app that was ran with -Xms512m -Xmx1024m , and on kubernetes deployment file -> requests.memory = 512M , limits.memory = 1.5G . I've enabled gc logs and seeing these on the pod logs: [2020-04-29T15:41:32.051+0000] GC(1533) Phase 1: Mark live objects [2020-04-29T15:41:32.133+0000] GC(1533) Phase 1: Mark live objects 81.782ms [2020-04-29T15:41:32.133+0000] GC(1533)