On Wed, May 29, 2013 at 12:48 PM, Vitaly Alekseev <[email protected]> wrote: > The v8::ResourceConstraints class is defined as follows: > > class V8EXPORT ResourceConstraints { > public: > ResourceConstraints(); > int max_young_space_size() const { return max_young_space_size_; } > void set_max_young_space_size(int value) { max_young_space_size_ = value; > } > int max_old_space_size() const { return max_old_space_size_; } > void set_max_old_space_size(int value) { max_old_space_size_ = value; } > int max_executable_size() { return max_executable_size_; } > void set_max_executable_size(int value) { max_executable_size_ = value; } > uint32_t* stack_limit() const { return stack_limit_; } > // Sets an address beyond which the VM's stack may not grow. > void set_stack_limit(uint32_t* value) { stack_limit_ = value; } > private: > int max_young_space_size_; > int max_old_space_size_; > int max_executable_size_; > uint32_t* stack_limit_; > }; > > Can someone tell me what young_space_size, old_space_size, and > max_executable_sizeare? What are their units, how are they related, etc.? > There doesn't seem to be much documentation.
V8's garbage collector is generational. The young and old spaces are where new and tenured objects respectively are hosted. The new space gets swept frequently, the old space is the "main" JS heap. (It's a little more complicated than that - there's a few other spaces but you can't control them directly.) V8 is a JIT rather than an interpreter, meaning it generates executable code that's stored in memory allocated with mmap(PROT_EXEC) or VirtualAlloc(). All ResourceConstraints units are in bytes. The corresponding command line flags are in kilobytes for --max_new_space_size and megabytes for --max_old_space_size and --max_executable_size. There's usually not much reason to tweak the new space or the executable size. The old space however has a direct impact on how much memory V8 will use it if has to: the default puts an upper limit of approximately 1.5 GB on x64 and 700 MB on ia32 and ARM (though the V8 that ships with Chrome on Android limits it to something much lower, I think.) -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
