2010/1/13 abc user <[email protected]> > The following code in serialize.cc: > > int top_format_length = StrLength(top_address_format) - 2; > for (uint16_t i = 0; i < Top::k_top_address_count; ++i) { > const char* address_name = AddressNames[i]; > Vector<char> name = > Vector<char>::New(top_format_length + StrLength(address_name) > + 1); > const char* chars = name.start(); > OS::SNPrintF(name, top_address_format, address_name); > Add(Top::get_address_from_id((Top::AddressId)i), TOP_ADDRESS, i, > chars); > } > > allocates a new Vector each loop iteration, shouldn't it call Dispose > () method on "name" to release the allocated memory at the end of the > for loop? >
That would free the string data, which is still used after the loop terminates. It is stored in the external reference table by the 'chars' argument of the 'Add(...)' call. This routine is only called once in the lifetime of the VM and the number of external references is small and bounded so memory leaks are probably not a concern. -- Erik Corry
-- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
