Commit Graph

6 Commits

Author SHA1 Message Date
Tony Tung
5e5270d3a7 [ctree] initialize the ManifestEntry in addChild after adding to the list
Summary: When a ManifestEntry is destroyed, we reap the heap-allocated resources it holds.  However, this (erroneously) happens when we create a ManifestEntry and add it to the list of children.  What we really need is a move constructor from C++11.  The workaround is to initialize a blank ManifestEntry, add it to the proper location, and then populate it afterwards.

Test Plan: addChild (in a later diff) no longer tramples over memory it no longer owns.

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D3772915

Signature: t1:3772915:1472174144:a4baac5cb5f6e01a38042c5c6cd92570c8f8e100
2016-08-26 13:49:17 -07:00
Tony Tung
13ec463298 [ctree] a newly instantiated ManifestEntry should point to a new Manifest
Test Plan: haven't used this yet, but it makes a whole lot of sense.

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D3770366

Signature: t1:3770366:1472173969:b83e10e27a63b863a3566d2df7cc861417b8208e
2016-08-26 13:49:17 -07:00
Tony Tung
a6bc389217 [ctree] free memory when destroying a treemanifest object
Summary: Everyone who holds heap-allocated memory gets destructors!

Test Plan: valgrind and confirmed no memory leaking from ctreemanifest

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D3763327

Tasks: 12818084

Signature: t1:3763327:1472105103:8ac9d9694be4bf3b09e19e4381737622c94a2dac
2016-08-26 14:00:37 -07:00
Tony Tung
75c02e78a9 [ctree] initialize all the fields in ManifestEntry constructor
Summary: It makes a destructor possible.

Test Plan: make local

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D3763322

Signature: t1:3763322:1472104242:e76ef1943c2082ddecff872c6472de4706505922
2016-08-26 13:49:17 -07:00
Tony Tung
e953a3cc27 [ctree] get rid of manifestkey
Summary: Directly pass in the path + len and the node.  Note that the path is now a char* + len, because this allows us to use the path in treemanifest_find directly, rather than to construct a new path.

Test Plan: run existing perftest without crash.

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D3738280

Signature: t1:3738280:1471890923:c13283f1c61dc020ba1918ee9b25c24dfd2fc19b
2016-08-22 15:42:03 -07:00
Tony Tung
33f0d41725 [ctree] modularize the code
Summary:
I like many small files.

There is one place where I'm making a functional change (convert.h) to satisfy angry compilers.

Test Plan: make local.

Reviewers: #fastmanifest, durham

Reviewed By: durham

Subscribers: mitrandir

Differential Revision: https://phabricator.intern.facebook.com/D3732584

Signature: t1:3732584:1471542758:d0b7804753ea4fd39a507090338ae3c5104dc7fa
2016-08-22 15:40:56 -07:00