heap

Using PTRACE_POKEDATA to replace data in the heap of a process

試著忘記壹切 提交于 2021-02-10 09:25:28
问题 I would like to use ptrace in order to attach my tool to a Linux process, read and write to the heap memory of this process and again detach my tool. Actually, it's not working although there is no error. I can not see any modifications in the heap memory of the process after I run the tool. Anyway, I'm quite not sure if that is possible in general. Currently, my C code looks like this: int res = 0, i = 0; int size = heap_address->end - heap_address->start; char tmp_page[size]; memset(tmp

PipedInputStream / PipedOutputStream in a tight “loop” :: Why the “java.lang.OutOfMemoryError: Java heap space”?

喜夏-厌秋 提交于 2021-02-08 06:37:32
问题 I am experimenting with PipedInputStream and PipedOutputStream and can't understand why the following code would result in a Java Heap exhaustion problem. All transient String objects created should be gc -ed. Why then do I get an OutOfMemoryError ? I am trying to write and read 1000 String objects each 1 million characters long. The below code fails about half-way through even when invoked with -Xmx2g . What's more the trace: written string #453 read string #453 written string #454 Exception

Heapq module implementation

风格不统一 提交于 2021-02-08 06:18:09
问题 I was reading the heapq module source because I reviewed a question on CodeReview and I cannot understand something. In the wikipedia article about heap it says: sift-up: move a node up in the tree, as long as needed; used to restore heap condition after insertion. Called "sift" because node moves up the tree until it reaches the correct level, as in a sieve. sift-down: move a node down in the tree, similar to sift-up; used to restore heap condition after deletion or replacement. But the code

If Java's generational garbage collectors traverse the graph of live objects, how do they know which objects to call finalize() on? [duplicate]

房东的猫 提交于 2021-02-04 18:08:31
问题 This question already has answers here : How does Java GC call finalize() method? (4 answers) How finalizable objects takes at least 2 garbage collection cycles before it can be reclaimed? (2 answers) why allocation phase can be increased if we override finalize method? (1 answer) Closed 11 months ago . My understanding is that GCs like ParallelGC and G1 are "generational" collectors. Garbage Collection almost happens as a byproduct, since you move all live objects to a new heap region and

If Java's generational garbage collectors traverse the graph of live objects, how do they know which objects to call finalize() on? [duplicate]

此生再无相见时 提交于 2021-02-04 18:08:02
问题 This question already has answers here : How does Java GC call finalize() method? (4 answers) How finalizable objects takes at least 2 garbage collection cycles before it can be reclaimed? (2 answers) why allocation phase can be increased if we override finalize method? (1 answer) Closed 11 months ago . My understanding is that GCs like ParallelGC and G1 are "generational" collectors. Garbage Collection almost happens as a byproduct, since you move all live objects to a new heap region and

If Java's generational garbage collectors traverse the graph of live objects, how do they know which objects to call finalize() on? [duplicate]

孤人 提交于 2021-02-04 18:07:50
问题 This question already has answers here : How does Java GC call finalize() method? (4 answers) How finalizable objects takes at least 2 garbage collection cycles before it can be reclaimed? (2 answers) why allocation phase can be increased if we override finalize method? (1 answer) Closed 11 months ago . My understanding is that GCs like ParallelGC and G1 are "generational" collectors. Garbage Collection almost happens as a byproduct, since you move all live objects to a new heap region and

If Java's generational garbage collectors traverse the graph of live objects, how do they know which objects to call finalize() on? [duplicate]

夙愿已清 提交于 2021-02-04 18:07:12
问题 This question already has answers here : How does Java GC call finalize() method? (4 answers) How finalizable objects takes at least 2 garbage collection cycles before it can be reclaimed? (2 answers) why allocation phase can be increased if we override finalize method? (1 answer) Closed 11 months ago . My understanding is that GCs like ParallelGC and G1 are "generational" collectors. Garbage Collection almost happens as a byproduct, since you move all live objects to a new heap region and

Dynamic array on stack (VLA) vs heap performance

瘦欲@ 提交于 2021-01-29 22:18:37
问题 Most of the time we can assume that stack is faster and cleaner. No memory fragmentation, easier to cache, quick allocation. That's also why people always assume that static buffer allocated on stack is much faster than dynamic buffer on heap. Is it? One misconception I see most of the time is that people assume that c99 extension (which is supported as non-standard extension in common C++ compilers like GCC) allocating dynamic sized array on stack will perform as fast as static size. I think

Stack and Heap about memory address question

▼魔方 西西 提交于 2021-01-29 15:59:59
问题 I knew what is stack and heap, but when I did some experiments on this topic, I found something surprising. int i,j; std::cout<< &i << "\n"; std::cout<< &j << "\n"; Results: 0x7a893a29e5b8 0x7a893a29e5bc That means stack is toward to high address, and not to low address which is shown by below graph. 来源: https://stackoverflow.com/questions/61540247/stack-and-heap-about-memory-address-question

Make java understand that swap exists, and encourage him to use it [closed]

喜欢而已 提交于 2021-01-29 07:12:43
问题 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 2 months ago . Improve this question So, I have a java jar to run on my raspberry pi, and it requires a lot of memory. I have set up 2 gb swap on an external usb flash drive. But when I start the jar with -Xmx2048M, it says that it could not reserve enough space for 2097152KB object heap. I know