[問題] Node.js 延伸模組的 memory leak已刪文
小弟最近在練習用 Rust 寫高階語言的延伸模組,repo 如下:
https://github.com/cwchentw/libmatrix-rust-demo
但小弟不解的是,為何以 Node.js 撰寫的模組的記憶體用量不斷上升?
小弟用 C 存取此模組,以 Valgrind 檢查沒有 memory leak
$ valgrind ./matrix
==4880== Memcheck, a memory error detector
==4880== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==4880== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==4880== Command: ./matrix
==4880==
==4880==
==4880== HEAP SUMMARY:
==4880== in use at exit: 0 bytes in 0 blocks
==4880== total heap usage: 5,000 allocs, 5,000 frees, 216,000 bytes allocated
==4880==
==4880== All heap blocks were freed -- no leaks are possible
==4880==
==4880== For counts of detected and suppressed errors, rerun with: -v
==4880== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
以 Python 存取此模組的記憶體用量如圖:http://imgur.com/8X7kFNy
可以看到記憶體用量維持水平
以 Ruby 存取此模組的記憶體用量如圖:http://imgur.com/XdQh2cM
同樣地,記憶體用量也是維持水平
而以 Node.js 存取此模組的記憶體用量如圖:http://imgur.com/03MJQa6
可以看出來記憶體用量持續爬升
不好意思,小弟沒有將數據正規化
只是讓大家看一下記憶體變化的趨勢而已
小弟比較沒有寫 Node.js 延伸模組的經驗,還在練習階段
不知道是那個地方出了問題,上來問一下各位大大
感謝看完長文,PTT 惠我良多
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.182.142.8
※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1482453518.A.5D3.html
推
12/23 11:33, , 1F
12/23 11:33, 1F
→
12/23 11:34, , 2F
12/23 11:34, 2F
→
12/23 11:46, , 3F
12/23 11:46, 3F
→
12/23 11:47, , 4F
12/23 11:47, 4F
→
12/23 11:47, , 5F
12/23 11:47, 5F
Programming 近期熱門文章
PTT數位生活區 即時熱門文章