First of all, Engilish is not my native language. Please excuse if there are any mistakes. As stated above, I want to create an ELF executable from process memory image. Up until now, I successfully extracted an ELF Header, Program Headers and a list of Elf64_Dyn structures resides in Dynamic segment. I also …
Tag: memory
Why the address of the pointer variable printed differently between two printf statements without any modification to the variable?
In below simple c test program two printf statements return different values. ( check last four printf statements). output : – I am running it in eclipse ide and using Ubuntu Linux. Why does it behave differently? Answer In several places you are using the wrong format specifier to printf. In particular…
How can I get a guarantee that when a memory is freed, the OS will reclaim that memory for it’s use?
I noticed that this program: which allocates 3 memories, 3 times and each time frees different memory, frees the memory according to watch free -m, which means that the OS reclaimed the memory for every free regardless of the memory’s position inside the program’s address space. Can I somehow get …
Will process’s RES memory drop after memory freed?
I have a process which continuously allocates memory and will free it after another thread have processed related data. When the data processing rate is slow, I see RES memory grows up; but after all the data have been processed, RES goes down but doesn’t go back to original RES value (even after waitin…
What HW resource is mostly used when one does memcpy()?
This feels like a very newbie question, but I suddenly find myself clueless. I’m trying to profile a c application that does a lot of memory copies, and there is an option for me to reduce that number (requires some re-design). I’m trying to realize if it’s worth it, but I have no idea what …
‘top’ shows Java program using more memory than Java profiler shows
What are the possible causes for when the Linux top command shows a Java process is using 14GBs of memory while Java profiling shows only 2GBs being used? Answer That means that your JVM / Java application is using off-heap memory. Lots of it. It could be memory-mapped files. It could be native libraries: unl…
Get hardware information from /proc filesytem in Linux
I use execv to run lshw command to get the CPU, disk, and memory in C code. But I would like to search another solution to get these information from /proc or any other existed data. Have any suggestion? Here is my code: Linux command: $ sudo lshw -short -c disk -c processor -c memory I have two questions: Wh…
Random mmaped memory access up to 16% slower than heap data access
Our software builds a data structure in memory that is about 80 gigabytes large. It can then either use this data structure directly to do its computation, or dump it to disk so it can be reused several times afterwards. A lot of random memory accesses happens in this data structure. For larger input this dat…
Mitigating memory leaks by forking
This is a really ugly question. I have a C++ program which does the following in a loop: Waits for a JMS message Calculates some data Sends a JMS message in response My program (let’s call it “Bob”) has a rather severe memory leak. The memory leak is located in a shared library that someone …
Memory used by compiling a code
I use time command to measure the time used to execute a file as: My question: are there any command like time can give the memory used by executing an executable file in linux? Answer You can use /usr/bin/time -v ./filename. It will print a lot of information including memory use. Note: Will use the shell bu…