Comments (3)
I was mistaken, it was Peter Wang who posted the code in this message:
Message: 4
Date: Fri, 6 Jun 2014 14:16:27 +1000
From: Peter Wang [email protected]
To: Christian Schafmeister [email protected]
Cc: [email protected]
Subject: Re: [Gc] Is there a way to walk the entire heap of live
objects
Message-ID: [email protected]
Content-Type: text/plain; charset=utf-8
On Thu, 05 Jun 2014 07:57:53 -0400, Christian Schafmeister [email protected] wrote:
Hi there,
Is there any functionality in the Boehm GC that would allow me to
freeze the garbage collector and walk the heap of live objects? I?d
like to take an inventory of all of the live objects to determine the
source of my current memory problems (30 GB of virtual memory used
after 4 hours of runtime).
Hi,
We do something like that in the Mercury project using the following
function.
I am not an expert on Boehm GC internals, and the code is only used in a
special memory profiling grade, so not heavily exercised.
Please let me know if there is something wrong with it.
Peter
(in reclaim.c)
STATIC void GC_mercury_do_enumerate_reachable_objects(struct hblk *hbp,
word dummy)
{
struct hblkhdr * hhdr = HDR(hbp);
size_t sz = hhdr -> hb_sz;
size_t bit_no;
char *p, *plim;
if (GC_block_empty(hhdr)) {
return;
}
p = hbp->hb_body;
bit_no = 0;
if (sz > MAXOBJBYTES) { /* one big object /
plim = p;
} else {
plim = hbp->hb_body + HBLKSIZE - sz;
}
/ Go through all words in block. */
while (p <= plim) {
if (mark_bit_from_hdr(hhdr, bit_no)) {
GC_mercury_callback_reachable_object((GC_word *)p,
BYTES_TO_WORDS(sz));
}
bit_no += MARK_BIT_OFFSET(sz);
p += sz;
}
}
GC_INNER void GC_mercury_enumerate_reachable_objects(void)
{
GC_ASSERT(GC_mercury_callback_reachable_object);
GC_apply_to_all_blocks(GC_mercury_do_enumerate_reachable_objects, (word)0);
}
from bdwgc.
please make a pull request
from bdwgc.
I made a pull request
from bdwgc.
Related Issues (20)
- Downstream libgc releases (Feb 2024) HOT 21
- GC hangs with "parallel mark" if using `GC_allow_register_threads()` HOT 11
- Debugging an issue with GC seemingly not happening on Emscripten/WebAssembly
- Upstream TLS support HOT 2
- How final are the finalizers? HOT 2
- Problem getting finalizers to work HOT 3
- Add examples collection of small programs showing how to use GC for varioues features and with different configurations HOT 2
- Support CHERI extension HOT 3
- using extra pointer bits on x86_64 (tagged pointer support) HOT 3
- Resolve warnings reported by cppcheck 2.13.3
- rare case of infinite loop on Android HOT 9
- gctest hang on msys64 if mprotected-based incremental collection is on HOT 9
- zig-msvc target error: 'unistd.h' file not found HOT 18
- Specify soversion for shared libs built by Zig
- Unexpected heap growth in gctest if no parallel marker
- cordtest hang on Windows if shared build by Zig using msvc HOT 7
- Some Windows gnu builds hang in zig build
- gctest hang sometimes on Windows if compiled with threads discovery
- Redirect malloc_usable_size() in leak_detector.h HOT 6
- Compilation with TCC fails on ARM macs HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bdwgc.