Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions base/gcutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ function take_heap_snapshot(io)
ccall(:jl_gc_take_heap_snapshot, Cvoid, (Ptr{Cvoid},), (io::IOStream).handle::Ptr{Cvoid})
end

# function take_heap_snapshot(path::String)
# open(path, "w") do f
# take_heap_snapshot(f)
# end
# end

"""
GC.enable_finalizers(on::Bool)

Expand Down
15 changes: 5 additions & 10 deletions src/gc-heap-snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,7 @@ size_t record_node_to_gc_snapshot(jl_value_t *a) JL_NOTSAFEPOINT {
? jl_array_nbytes((jl_array_t*)a)
: (size_t)jl_datatype_size(type);

// print full type
// TODO(PR): Is it possible to use a variable size string here, instead??
ios_t str_;
ios_mem(&str_, 1048576); // 1 MiB
JL_STREAM* str = (JL_STREAM*)&str_;

jl_static_show(str, (jl_value_t*)type);

name = string((const char*)str_.buf, str_.size);
ios_close(&str_);
name = jl_symbol_name(type->name->name);
}
}

Expand Down Expand Up @@ -295,6 +286,10 @@ bool _fieldpath_for_slot_helper(
out.push_back(inlineallocd_field_type_t(objtype, field_name));
return true;
}
// if ((size_t) field_type < 1e8) {
// jl_printf(JL_STDERR, "invalid field type\n");
// continue;
// }
// If the field is an inline-allocated struct
if (jl_stored_inline((jl_value_t*)field_type)) {
bool found = _fieldpath_for_slot_helper(out, field_type, fieldaddr, slot);
Expand Down