mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 20:25:12 -05:00
Remove leaks from snapshot_creator
This commit is contained in:
parent
9e839b7e23
commit
0bec0fa594
2 changed files with 13 additions and 9 deletions
14
.travis.yml
14
.travis.yml
|
@ -93,18 +93,20 @@ script:
|
||||||
./tools/test_format.py
|
./tools/test_format.py
|
||||||
|
|
||||||
- |-
|
- |-
|
||||||
# LSAN build of test_cc. We are in the process of getting a
|
# LSAN build. We are in the process of getting a completely clean LSAN build,
|
||||||
# completely clean LSAN build, but it will take some work. So for now
|
# but it will take some work. So for now we just run a subset of the tests.
|
||||||
# we just run a single test that passes under LSAN.
|
|
||||||
echo is_asan=true >> target/debug/args.gn
|
echo is_asan=true >> target/debug/args.gn
|
||||||
echo is_lsan=true >> target/debug/args.gn
|
echo is_lsan=true >> target/debug/args.gn
|
||||||
DENO_BUILD_MODE=debug ./tools/build.py -j2 test_cc
|
# We want to detect leaks during the build process as well as when executing
|
||||||
ASAN_OPTIONS=detect_leaks=1 ./target/debug/test_cc
|
# the tests. So set the ASAN_OPTIONS env var before build.py is run.
|
||||||
|
export ASAN_OPTIONS=detect_leaks=1
|
||||||
|
./tools/build.py -C target/debug -j2
|
||||||
|
./target/debug/test_cc
|
||||||
|
|
||||||
- |-
|
- |-
|
||||||
# Release build and test
|
# Release build and test
|
||||||
bash -c "sleep 2100; pkill ninja; pkill cargo" &
|
bash -c "sleep 2100; pkill ninja; pkill cargo" &
|
||||||
DENO_BUILD_MODE=release ./tools/build.py -j2
|
./tools/build.py -C target/release -j2
|
||||||
DENO_BUILD_MODE=release ./tools/test.py
|
DENO_BUILD_MODE=release ./tools/test.py
|
||||||
|
|
||||||
- |-
|
- |-
|
||||||
|
|
|
@ -34,11 +34,13 @@ int main(int argc, char** argv) {
|
||||||
source_map_fn != nullptr ? source_map.c_str() : nullptr);
|
source_map_fn != nullptr ? source_map.c_str() : nullptr);
|
||||||
|
|
||||||
auto snapshot = deno_get_snapshot(d);
|
auto snapshot = deno_get_snapshot(d);
|
||||||
std::string snapshot_str(reinterpret_cast<char*>(snapshot.data_ptr),
|
|
||||||
snapshot.data_len);
|
|
||||||
|
|
||||||
std::ofstream file_(snapshot_out_bin, std::ios::binary);
|
std::ofstream file_(snapshot_out_bin, std::ios::binary);
|
||||||
file_ << snapshot_str;
|
file_.write(reinterpret_cast<char*>(snapshot.data_ptr), snapshot.data_len);
|
||||||
file_.close();
|
file_.close();
|
||||||
|
|
||||||
|
delete[] snapshot.data_ptr;
|
||||||
|
deno_delete(d);
|
||||||
|
|
||||||
return file_.bad();
|
return file_.bad();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue