mirror of
https://github.com/antirez/aocla
synced 2024-12-27 09:58:32 +01:00
Markdown fixes.
This commit is contained in:
parent
6d34f5462b
commit
e69deac83e
1 changed files with 264 additions and 264 deletions
|
@ -874,12 +874,12 @@ push it on the stack and the object has still a single reference.
|
||||||
|
|
||||||
Now imagine that, instead, the object is shared and also lives in a
|
Now imagine that, instead, the object is shared and also lives in a
|
||||||
variable. In this case we pop an object that has two references, call
|
variable. In this case we pop an object that has two references, call
|
||||||
`getUnsharedObject() that will return us a copy with a *recount* of one. We
|
`getUnsharedObject()` that will return us a copy with a *recount* of one. We
|
||||||
change the object and push it to the stack. The new object will have a
|
change the object and push it to the stack. The new object will have a
|
||||||
single reference on the stack, and has a reference count of one: all is
|
single reference on the stack, and has a reference count of one: all is
|
||||||
fine. What about the old object stored in the local variable? It should
|
fine. What about the old object stored in the local variable? It should
|
||||||
have a reference count of one as well, but if we don't `release()` it
|
have a reference count of one as well, but if we don't `release()` it
|
||||||
in getUnsharedObject() it would have two, causing a memory leak.
|
in `getUnsharedObject()` it would have two, causing a memory leak.
|
||||||
|
|
||||||
I'll not show the `deepCopy()` function, it just allocates a new object of the specified type and copy the content. But guess what? It's a recursive function.
|
I'll not show the `deepCopy()` function, it just allocates a new object of the specified type and copy the content. But guess what? It's a recursive function.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue