One obvious observation is that you don't have a delete isolate; statement
in the loop ;-)

On Sat, May 12, 2018 at 8:42 AM YJ <yang.ji...@celigo.com> wrote:

> Kinda related to this old thread
> https://groups.google.com/forum/#!searchin/v8-users/isolate$20memory|sort:date/v8-users/C_CzX8nSbDU/c4FR8-j6BQAJ
>
> Basically, I'd imagine if I instantiate an isolate and immediately
> "Dispose" it inside a loop, all memory used by the isolated should be
> released therefore the loop could go on forever. In reality however, doing
> this would consume all available memories and doesn't seem to release any
> memory back to the os at all. It is not a "leak" in the sense that it can
> be caught by valgrind, it appears something is actually hogging the memory.
> I am really curious of what is holding onto the memory. I really hope I am
> just missing something obvious and any help is appreciated.
>
> I test the following code on a MBP
>
> #include "v8/include/v8.h"
> #include "v8/include/libplatform/libplatform.h"
>
> int main(int argc, char* argv[]) {
>   v8::V8::InitializeICUDefaultLocation(V8_LIB_FULL_PATH);
>   v8::V8::InitializeExternalStartupData(V8_LIB_FULL_PATH);
>   std::unique_ptr<v8::Platform> platform =
> v8::platform::NewDefaultPlatform();
>   v8::V8::InitializePlatform(platform.get());
>   v8::V8::Initialize();
>   for (auto i = 0; i < 1000000000; ++i) {
>     v8::Isolate::CreateParams create_params;
>     create_params.array_buffer_allocator =
> v8::ArrayBuffer::Allocator::NewDefaultAllocator();
>     v8::Isolate* isolate = v8::Isolate::New(create_params);
>     isolate->Dispose();
>     delete create_params.array_buffer_allocator;
>   }
>   v8::V8::Dispose();
>   v8::V8::ShutdownPlatform();
> }
>
> It will run until all memory is gone and macOS will just be unresponsive.
>
> I was using v8 version 6.5 and with the following build args
>
> is_debug = false
> target_cpu = "x64"
> use_drfuzz = false
> use_libfuzzer = false
> v8_enable_test_features = ""
> v8_experimental_extra_library_files = []
> v8_extra_library_files = []
> symbol_level = 1
> is_component_build = false
> use_sysroot = false
> use_glib = false
> use_custom_libcxx = false
> use_custom_libcxx_for_host = false
> v8_enable_i18n_support = false
> icu_use_data_file = false
> v8_static_library = true
> v8_enable_gdbjit = false
>
> Thanks
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to