addyosmani / addyosmani/essential-js-design-patterns

question: design pattern to avoid memory leaks

オープン
#98 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
HTML
スター
4.9k
フォーク
804
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi @addyosmani ,

Your design pattern book is awesome. I am working with nodejs and need some advice on scenarios like below:

Lets say i have a function that makes persistent tcp connection to say twitter and does all the parsing on that.
Eg:

```
function addTwitter(somedata) {

var twit = new Twitter(somedata);
twit.on('twit', function(err,data) {
//do something here
// use somedata variable here.
}

}

addTwitter(somehandle);
addTwitter(anotherhandle);
```

so basically this addTwitter is used to make multiple connections to twitter server.

I am wondering if this style will leak memory. Also, If there is a better way of doing this.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。