mardi 25 août 2015

C++11 , leaking memory

I have a case which the instrument of Xcode detected

std::vector<UserID_t> functions::getUserIds() const { static_assert(sizeof(int64) == sizeof(uint64_t), "size is not matched"); auto object = AAAAA::BBBB::ValueObject<int64 *>(_hash->getValue((nByte)Key::USER_IDS)); auto size = object.getSizes(); std::vector<UserID_t> ret(*size); auto pVal = object.getDataCopy(); for (int index = 0; index < *size; index++) { ret[index] = *pVal; ++pVal; } return ret; } the tool show me that the elements in "ret" is not release after return . But i think int64 is the scalar variable . I don't need to release them . is it right ?

I use Xcode 6.3.2 .

Many thanks .

Aucun commentaire:

Enregistrer un commentaire