Out of memory (已爬文) - Linux

By Isabella
at 2014-12-27T11:33
at 2014-12-27T11:33
Table of Contents
想請問各位前輩
我在Linux(2.6.36) 上寫了一個"收UART資料 存到SD"的程式
在測試的時候發現擺了約1天後 就發生out of memory 死機
(確認沒有我的程式 不會out of mmemory死機)
使用過 mtrace 來抓程式碼memory leak
但結果並無 memory leak
只有一個link list 沒有free 是我來存設定檔的
我在 開機後一分鐘 和 擺了半天後 各抓了一份 /proc/slabinfo
發現有兩個值相差過大 而且都持續增加不會減少
開機
inode_cache 552 658 272 14 1 : tunables 54 27 0 : slabdata 47 47 0
size-32 7200 7260 128 30 1 : tunables 120 60 0 : slabdata 242 242 0
半天
inode_cache 36246 36246 272 14 1 : tunables 54 27 0 : slabdata 2589 2589 0
size-32 41010 41010 128 30 1 : tunables 120 60 0 : slabdata 1367 1367 0
這兩個項目代表 inode_cache(filesystem) size-32(malloc 使用這個)
網路上查了一下 可下 sync;echo 3 > /proc/sys/vm/drop_caches
手動清除 pagecache、dentry、inode
但用過之後情況並沒有改善
我也有檢查過我的程式 所以malloc 都有 free
想請問
1.inode_cache 除了 用 /proc/sys/vm/drop_caches 手動清除
還有甚麼方法可以清除?
5B
2.size-32 我已確定我的程式有malloc 的地方都有做free
有fopen 的地方 都有fclose
為甚麼 size-32 的 使用數 還是一直往上加??
3.使用thread 會是造成這個問題的原因嗎??
--
我在Linux(2.6.36) 上寫了一個"收UART資料 存到SD"的程式
在測試的時候發現擺了約1天後 就發生out of memory 死機
(確認沒有我的程式 不會out of mmemory死機)
使用過 mtrace 來抓程式碼memory leak
但結果並無 memory leak
只有一個link list 沒有free 是我來存設定檔的
我在 開機後一分鐘 和 擺了半天後 各抓了一份 /proc/slabinfo
發現有兩個值相差過大 而且都持續增加不會減少
開機
inode_cache 552 658 272 14 1 : tunables 54 27 0 : slabdata 47 47 0
size-32 7200 7260 128 30 1 : tunables 120 60 0 : slabdata 242 242 0
半天
inode_cache 36246 36246 272 14 1 : tunables 54 27 0 : slabdata 2589 2589 0
size-32 41010 41010 128 30 1 : tunables 120 60 0 : slabdata 1367 1367 0
這兩個項目代表 inode_cache(filesystem) size-32(malloc 使用這個)
網路上查了一下 可下 sync;echo 3 > /proc/sys/vm/drop_caches
手動清除 pagecache、dentry、inode
但用過之後情況並沒有改善
我也有檢查過我的程式 所以malloc 都有 free
想請問
1.inode_cache 除了 用 /proc/sys/vm/drop_caches 手動清除
還有甚麼方法可以清除?
5B
2.size-32 我已確定我的程式有malloc 的地方都有做free
有fopen 的地方 都有fclose
為甚麼 size-32 的 使用數 還是一直往上加??
3.使用thread 會是造成這個問題的原因嗎??
--
Tags:
Linux
All Comments

By Candice
at 2014-12-28T05:50
at 2014-12-28T05:50

By Vanessa
at 2014-12-29T00:34
at 2014-12-29T00:34

By Delia
at 2014-12-29T19:10
at 2014-12-29T19:10

By Valerie
at 2015-01-01T22:12
at 2015-01-01T22:12

By Elizabeth
at 2015-01-02T00:50
at 2015-01-02T00:50

By Kama
at 2015-01-06T13:55
at 2015-01-06T13:55

By Robert
at 2015-01-11T11:34
at 2015-01-11T11:34

By Poppy
at 2015-01-12T10:45
at 2015-01-12T10:45

By Jacky
at 2015-01-13T17:34
at 2015-01-13T17:34

By Enid
at 2015-01-14T11:03
at 2015-01-14T11:03

By Dora
at 2015-01-17T11:06
at 2015-01-17T11:06

By Catherine
at 2015-01-22T02:07
at 2015-01-22T02:07

By William
at 2015-01-26T10:55
at 2015-01-26T10:55

By Catherine
at 2015-01-30T18:51
at 2015-01-30T18:51

By Quintina
at 2015-02-03T08:42
at 2015-02-03T08:42

By Blanche
at 2015-02-04T04:40
at 2015-02-04T04:40

By Jake
at 2015-02-07T15:24
at 2015-02-07T15:24

By Michael
at 2015-02-09T17:32
at 2015-02-09T17:32

By Joseph
at 2015-02-12T17:36
at 2015-02-12T17:36

By Joseph
at 2015-02-14T20:49
at 2015-02-14T20:49

By Edith
at 2015-02-19T20:33
at 2015-02-19T20:33

By Donna
at 2015-02-22T23:26
at 2015-02-22T23:26

By Charlotte
at 2015-02-23T15:16
at 2015-02-23T15:16

By Donna
at 2015-02-24T10:36
at 2015-02-24T10:36

By Blanche
at 2015-02-27T16:00
at 2015-02-27T16:00

By Ingrid
at 2015-03-03T06:53
at 2015-03-03T06:53

By Tracy
at 2015-03-07T05:05
at 2015-03-07T05:05
Related Posts
請問xrdp編譯的問題

By Daniel
at 2014-12-27T11:12
at 2014-12-27T11:12
Syslinux Menu Password 求助~~

By Andrew
at 2014-12-26T22:28
at 2014-12-26T22:28
哪裡能租或借Solaris Sparc的機器呢?

By Quanna
at 2014-12-26T21:53
at 2014-12-26T21:53
Flask running

By Eden
at 2014-12-25T18:15
at 2014-12-25T18:15
dialog和putty顯示

By Lucy
at 2014-12-25T17:39
at 2014-12-25T17:39