memory

How to modify the malloc behavior in glibc and test if it works as expected?

青春壹個敷衍的年華 提交于 2020-07-23 06:23:34
问题 I want to use malloc to allocate memory, but I don't want to use a dynamic allocation way in malloc. Instead, I want to use malloc to allocate a large block/pool so that I can "new" some variables/objects into this large memory block/pool. Therefore, I would like to modify the malloc source code (e.g., malloc/malloc.c ) in glibc to make it work for my scenario. What is the most convenient and efficient way to modify glibc source codes and also test its functionality? One way that comes to my

How to load (or map) file part maximum size, but fit in RAM on Windows?

|▌冷眼眸甩不掉的悲伤 提交于 2020-07-23 06:22:23
问题 There is big file. I need fast sort it. I going to process the file by part, that fit in RAM, to avoid/degrees using page file (next step: merge parts). How to use max RAM? My solution: use WinApi file memory mapping, but I don't knew how to get part of file maximum size, but fit RAM (how to determine size)? 回答1: You can VirtualLock the pages you want to process. It locks in physical memory the size you need (if there is enough) swapping others to the paging file. You can use the

How to modify the malloc behavior in glibc and test if it works as expected?

痴心易碎 提交于 2020-07-23 06:22:12
问题 I want to use malloc to allocate memory, but I don't want to use a dynamic allocation way in malloc. Instead, I want to use malloc to allocate a large block/pool so that I can "new" some variables/objects into this large memory block/pool. Therefore, I would like to modify the malloc source code (e.g., malloc/malloc.c ) in glibc to make it work for my scenario. What is the most convenient and efficient way to modify glibc source codes and also test its functionality? One way that comes to my

How to modify the malloc behavior in glibc and test if it works as expected?

别说谁变了你拦得住时间么 提交于 2020-07-23 06:21:12
问题 I want to use malloc to allocate memory, but I don't want to use a dynamic allocation way in malloc. Instead, I want to use malloc to allocate a large block/pool so that I can "new" some variables/objects into this large memory block/pool. Therefore, I would like to modify the malloc source code (e.g., malloc/malloc.c ) in glibc to make it work for my scenario. What is the most convenient and efficient way to modify glibc source codes and also test its functionality? One way that comes to my

How to load (or map) file part maximum size, but fit in RAM on Windows?

情到浓时终转凉″ 提交于 2020-07-23 06:20:42
问题 There is big file. I need fast sort it. I going to process the file by part, that fit in RAM, to avoid/degrees using page file (next step: merge parts). How to use max RAM? My solution: use WinApi file memory mapping, but I don't knew how to get part of file maximum size, but fit RAM (how to determine size)? 回答1: You can VirtualLock the pages you want to process. It locks in physical memory the size you need (if there is enough) swapping others to the paging file. You can use the

Calculate memory accesses

拈花ヽ惹草 提交于 2020-07-22 06:39:27
问题 xor dword [0x301a80], 0x12345 How many memory access when we know the op code and addressing mode is 2 bytes? If I understand correctly, even thought it is 0x12345, this is acctually still 4 bytes and we cant attach it to 0x301a80, right? So we have here: 2 + 4 + 4 bytes (And not 2 + 3.5 + 2.5 = 8) which is 4 memory access. Am I think right? 回答1: The total instruction size is 10 bytes (in 32-bit mode). That takes probably 0 to 2 I-cache accesses on a modern x86 to fetch in aligned 16-byte

What does output indicate when larger address is subtracted from smaller address in C/C++ programming?

被刻印的时光 ゝ 提交于 2020-07-22 05:50:09
问题 Given a snippet of code as: int a[5]; printf("%u\n",&a[3]-&a[0]); printf("%u",&a[0]-&a[3]); now the output of first line in subtraction of addresses is as per formula ( (addg - adds)/size of data type ) where, addg is greater than adds. The output for above snippet in gcc is: 3 4294967293 The first line output (i.e. is 3) is obvious but what is the meaning of second output or what happens when larger address is subtracted from smaller one (i.e. adds - addg)? 回答1: The problem in your code is

Why does intel use a virtual index physical tagged cache and not VIVT or PIPT?

纵然是瞬间 提交于 2020-07-18 06:07:25
问题 I am not sure, but if i remember right intel uses a VIPT cache, i would like to know the reason of this choice, why is it better than VIVT or PIPT, what advantages does it procure and maybe what disadvantages. Thank you. 回答1: The exact design decisions are probably not published, but in general the benefits for VIPT are : Virtual indexing means you can start reading the set from the cache before (or in parallel with) looking up the translation in the TLB. This means that the common case

Why does intel use a virtual index physical tagged cache and not VIVT or PIPT?

牧云@^-^@ 提交于 2020-07-18 06:06:42
问题 I am not sure, but if i remember right intel uses a VIPT cache, i would like to know the reason of this choice, why is it better than VIVT or PIPT, what advantages does it procure and maybe what disadvantages. Thank you. 回答1: The exact design decisions are probably not published, but in general the benefits for VIPT are : Virtual indexing means you can start reading the set from the cache before (or in parallel with) looking up the translation in the TLB. This means that the common case

Confused about Intel Optane DC SSD usage as extra RAM with IMDT? [closed]

旧时模样 提交于 2020-07-15 09:46:06
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 12 days ago . Improve this question I'm a little confused about Intel Optane DC. I want that my Optane DC will be able to perform as DRAM and storage both. On the one hand, I understood that only "Intel Optane DC Persistent Memory DIMM" is able to perform as DRAM.That it because he has 2 modes