fix remaining memory leaks
This commit is contained in:
		
							parent
							
								
									88971b4e69
								
							
						
					
					
						commit
						83a42271ad
					
				
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							@ -177,8 +177,16 @@ If you want to see an issue fixed, please subscribe to the thread (or remind me
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Changelog
 | 
					## Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 10.0.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Support for more complex types (a type can be a composition of several types)
 | 
				
			||||||
 | 
					* Fixes several memory leaks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 9.0.0
 | 
					### 9.0.0
 | 
				
			||||||
There were several rolling updates from 0.6 to 0.8. We'll now follow the semver versioning scheme. This is all what this jump from 0.8 to 9.0 is about.
 | 
					There were several rolling updates from 0.6 to 0.8. We consider Yjs stable since a long time, 
 | 
				
			||||||
 | 
					and intend to continue stable releases. From this release forward y-* modules will implement peer-dependencies for npm, and dependencies for bower.
 | 
				
			||||||
 | 
					Furthermore, incompatible yjs instances will now throw errors when syncing - this feature was influenced by #48. The versioning jump was influenced by react (see [here](https://facebook.github.io/react/blog/2016/02/19/new-versioning-scheme.html))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 0.6.0
 | 
					### 0.6.0
 | 
				
			||||||
This is a complete rewrite of the 0.5 version of Yjs. Since Yjs 0.6.0 it is possible to work asynchronously on a persistent database, which enables offline support.
 | 
					This is a complete rewrite of the 0.5 version of Yjs. Since Yjs 0.6.0 it is possible to work asynchronously on a persistent database, which enables offline support.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "yjs",
 | 
					  "name": "yjs",
 | 
				
			||||||
  "version": "9.1.0",
 | 
					  "version": "10.0.0",
 | 
				
			||||||
  "description": "A framework for real-time p2p shared editing on arbitrary complex data types",
 | 
					  "description": "A framework for real-time p2p shared editing on arbitrary complex data types",
 | 
				
			||||||
  "main": "./src/y.js",
 | 
					  "main": "./src/y.js",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
 | 
				
			|||||||
@ -19,6 +19,8 @@ module.exports = function (Y/* :any */) {
 | 
				
			|||||||
    userId: UserId;
 | 
					    userId: UserId;
 | 
				
			||||||
    send: Function;
 | 
					    send: Function;
 | 
				
			||||||
    broadcast: Function;
 | 
					    broadcast: Function;
 | 
				
			||||||
 | 
					    broadcastOpBuffer: Array<Operation>;
 | 
				
			||||||
 | 
					    protocolVersion: number;
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
      opts contains the following information:
 | 
					      opts contains the following information:
 | 
				
			||||||
@ -51,7 +53,7 @@ module.exports = function (Y/* :any */) {
 | 
				
			|||||||
      this.broadcastedHB = false
 | 
					      this.broadcastedHB = false
 | 
				
			||||||
      this.syncStep2 = Promise.resolve()
 | 
					      this.syncStep2 = Promise.resolve()
 | 
				
			||||||
      this.broadcastOpBuffer = []
 | 
					      this.broadcastOpBuffer = []
 | 
				
			||||||
      this.protocolVersion = 8
 | 
					      this.protocolVersion = 10
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    reconnect () {
 | 
					    reconnect () {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -150,7 +152,8 @@ module.exports = function (Y/* :any */) {
 | 
				
			|||||||
          conn.send(syncUser, {
 | 
					          conn.send(syncUser, {
 | 
				
			||||||
            type: 'sync step 1',
 | 
					            type: 'sync step 1',
 | 
				
			||||||
            stateSet: stateSet,
 | 
					            stateSet: stateSet,
 | 
				
			||||||
            deleteSet: deleteSet
 | 
					            deleteSet: deleteSet,
 | 
				
			||||||
 | 
					            protocolVersion: conn.protocolVersion
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
@ -234,7 +237,8 @@ module.exports = function (Y/* :any */) {
 | 
				
			|||||||
            type: 'sync step 2',
 | 
					            type: 'sync step 2',
 | 
				
			||||||
            os: ops,
 | 
					            os: ops,
 | 
				
			||||||
            stateSet: currentStateSet,
 | 
					            stateSet: currentStateSet,
 | 
				
			||||||
            deleteSet: ds
 | 
					            deleteSet: ds,
 | 
				
			||||||
 | 
					            protocolVersion: this.protocolVersion
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
          if (this.forwardToSyncingClients) {
 | 
					          if (this.forwardToSyncingClients) {
 | 
				
			||||||
            conn.syncingClients.push(sender)
 | 
					            conn.syncingClients.push(sender)
 | 
				
			||||||
 | 
				
			|||||||
@ -182,6 +182,10 @@ g.compareAllUsers = async(function * compareAllUsers (users) {
 | 
				
			|||||||
  for (var uid = 0; uid < users.length; uid++) {
 | 
					  for (var uid = 0; uid < users.length; uid++) {
 | 
				
			||||||
    var u = users[uid]
 | 
					    var u = users[uid]
 | 
				
			||||||
    u.db.requestTransaction(function * () {
 | 
					    u.db.requestTransaction(function * () {
 | 
				
			||||||
 | 
					      var sv = yield* this.getStateVector()
 | 
				
			||||||
 | 
					      for (var s of sv) {
 | 
				
			||||||
 | 
					        yield* this.updateState(s.user)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      // compare deleted ops against deleteStore
 | 
					      // compare deleted ops against deleteStore
 | 
				
			||||||
      yield* this.os.iterate(this, null, null, function * (o) {
 | 
					      yield* this.os.iterate(this, null, null, function * (o) {
 | 
				
			||||||
        if (o.deleted === true) {
 | 
					        if (o.deleted === true) {
 | 
				
			||||||
 | 
				
			|||||||
@ -156,30 +156,19 @@ module.exports = function (Y/* :any */) {
 | 
				
			|||||||
    * deleteList (start) {
 | 
					    * deleteList (start) {
 | 
				
			||||||
      while (start != null) {
 | 
					      while (start != null) {
 | 
				
			||||||
        start = yield* this.getOperation(start)
 | 
					        start = yield* this.getOperation(start)
 | 
				
			||||||
        if (start.gc) {
 | 
					        if (!start.gc) {
 | 
				
			||||||
          break
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          start.gc = true
 | 
					          start.gc = true
 | 
				
			||||||
          start.deleted = true
 | 
					          start.deleted = true
 | 
				
			||||||
          yield* this.setOperation(start)
 | 
					          yield* this.setOperation(start)
 | 
				
			||||||
          yield* this.markDeleted(start.id, 1)
 | 
					          yield* this.markDeleted(start.id, 1)
 | 
				
			||||||
          if (start.opContent != null) {
 | 
					          if (start.opContent != null) {
 | 
				
			||||||
            yield* this.deleteOperation(start.opContent)
 | 
					            yield* this.deleteOperation(start.opContent)
 | 
				
			||||||
            /*
 | 
					 | 
				
			||||||
            yield* this.deleteOperation(start.opContent)
 | 
					 | 
				
			||||||
            var opContent = yield* this.getOperation(start.opContent)
 | 
					 | 
				
			||||||
            opContent.gc = true
 | 
					 | 
				
			||||||
            yield* this.setOperation(opContent)
 | 
					 | 
				
			||||||
            if (this.store.y.connector.isSynced) {            
 | 
					 | 
				
			||||||
              this.store.gc1.push(opContent.id)
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            */
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          if (this.store.y.connector.isSynced){
 | 
					          if (this.store.y.connector.isSynced){
 | 
				
			||||||
            this.store.gc1.push(start.id)
 | 
					            this.store.gc1.push(start.id)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          start = start.right
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        start = start.right
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -561,15 +550,15 @@ module.exports = function (Y/* :any */) {
 | 
				
			|||||||
            // so we have to set right here
 | 
					            // so we have to set right here
 | 
				
			||||||
            yield* this.setOperation(right)
 | 
					            yield* this.setOperation(right)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          // o may originate in another operation.
 | 
					        }
 | 
				
			||||||
          // Since o is deleted, we have to reset o.origin's `originOf` property
 | 
					        // o may originate in another operation.
 | 
				
			||||||
          if (o.origin != null) {
 | 
					        // Since o is deleted, we have to reset o.origin's `originOf` property
 | 
				
			||||||
            var origin = yield* this.getOperation(o.origin)
 | 
					        if (o.origin != null) {
 | 
				
			||||||
            origin.originOf = origin.originOf.filter(function (_id) {
 | 
					          var origin = yield* this.getOperation(o.origin)
 | 
				
			||||||
              return !Y.utils.compareIds(id, _id)
 | 
					          origin.originOf = origin.originOf.filter(function (_id) {
 | 
				
			||||||
            })
 | 
					            return !Y.utils.compareIds(id, _id)
 | 
				
			||||||
            yield* this.setOperation(origin)
 | 
					          })
 | 
				
			||||||
          }
 | 
					          yield* this.setOperation(origin)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        var parent
 | 
					        var parent
 | 
				
			||||||
        if (o.parent != null){ 
 | 
					        if (o.parent != null){ 
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user