Collection method, implemented by a first electronic device comprising a first, volatile memory, said first electronic device interacting with a second electronic device comprising a second, non-volatile memory, the first and second memories comprising objects each constituting an instance of a class of an object-oriented language, each object being liable to comprise at least one reference pointing to another object, the method comprising: - detecting at least one object in the first memory and at least one object in the second memory, constituting roots of persistence; - analysing at least some of the objects contained in the first and second memories by scanning, from the roots of persistence, a tree of objects which is determined dynamically on the basis of each reference, contained in the analysed objects, which points to another object; wherein said analysis comprises, iteratively for each analysed object in the tree of objects: ∘ if the analysed object is in the second memory and has no copy in the first memory, allocating, in the first memory, an object, referred to as a clone object, representing a copy of said analysed object as well as an object, referred to as a location object, comprising a first reference pointing to the clone object in the first memory and a second reference pointing to the analysed object in the second memory; ∘ identifying each reference, contained in said analysed object, pointing, in the tree of objects, to another object, referred to as a referenced object; and ∘ defining, for each identified reference, a type of said reference from among a first type, referred to as a strong reference, and a second type, referred to as a weak reference, in accordance with predefined criteria; said analysis continuing along the tree of objects only for each referenced object to which a strong reference points from the analysed object; and - upon detecting that said analysis is complete, collecting in the first and second memories in order to delete each object which was not analysed during said analysis. - detecting at least one object in the first memory and at least one object in the second memory, constituting roots of persistence; - analysing at least some of the objects contained in the first and second memories by scanning, from the roots of persistence, a tree of objects which is determined dynamically on the basis of each reference, contained in the analysed objects, which points to another object; wherein said analysis comprises, iteratively for each analysed object in the tree of objects: ∘ if the analysed object is in the second memory and has no copy in the first memory, allocating, in the first memory, an object, referred to as a clone object, representing a copy of said analysed object as well as an object, referred to as a location object, comprising a first reference pointing to the clone object in the first memory and a second reference pointing to the analysed object in the second memory; ∘ identifying each reference, contained in said analysed object, pointing, in the tree of objects, to another object, referred to as a referenced object; and ∘ defining, for each identified reference, a type of said reference from among a first type, referred to as a strong reference, and a second type, referred to as a weak reference, in accordance with predefined criteria; said analysis continuing along the tree of objects only for each referenced object to which a strong reference points from the analysed object; and ∘ if the analysed object is in the second memory and has no copy in the first memory, allocating, in the first memory, an object, referred to as a clone object, representing a copy of said analysed object as well as an object, referred to as a location object, comprising a first reference pointing to the clone object in the first memory and a second reference pointing to the analysed object in the second memory; ∘ identifying each reference, contained in said analysed object, pointing, in the tree of objects, to another object, referred to as a referenced object; and ∘ defining, for each identified reference, a type of said reference from among a first type, referred to as a strong reference, and a second type, referred to as a weak reference, in accordance with predefined criteria; said analysis continuing along the tree of objects only for each referenced object to which a strong reference points from the analysed object; and - upon detecting that said analysis is complete, collecting in the first and second memories in order to delete each object which was not analysed during said analysis.