c++ - Virtual storage increases for a continuously running application -
before ask question let me explain environment:
- i have c/c++ application runs continuously (infinite loop) inside embedded linux device.
- the application records data system , stores them in text files on sd-card (1 file per day).
- the recording occurs on specific trigger detected systems (each 5 minutes example) , each trigger inserts new line in text files.
- typical datatypes used within application are:
(o/i)stream
,char
arrays,char*
,c_str()
function,struct
s ,struct*
,static string
arrays,#define
,enums
,file*
,vector<>
, , usual ones (int
,string
, etc.). of these datatypes passed arguments functions. - the application cross compiled custom gcc compiler within buildroot , busybox package device's cpu atmel at91rm9200qu.
- the application executes system commands using
popen
in output read using resultingfile*
now application running 3 days , noticed increase of 32 kb byte in virtual storage (vsz top
command) each day. mistake device restarted, launched application again , vsz value started usual value on each fresh start (about 2532 kb).
i developed application monitors vsz value application , scheduled using crontab
each on each our start monitor. noticed @ point during day 32 kb noticed happened 4 kb each hour.
so main question is, reason vsz increase ? reach limit causing system crash concern because device have approx. 27 mb of ram.
update: beside vsz value, rss increases. ran application under valgrind --leak-check=full
, after first recording aborted application , following message appeared many many times!.
==28211== 28 bytes in 1 blocks possibly lost in loss record 15 of 52 ==28211== @ 0x4c29670: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==28211== 0x4ef33d8: std::string::_rep::_s_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.19) ==28211== 0x4ef4b00: char* std::string::_s_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/libstdc++.so.6.0.19) ==28211== 0x4ef4f17: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.19) ==28211== 0x403842: __static_initialization_and_destruction_0 (gatewayfunctions.h:28) *==28211== 0x403842: _global__sub_i__z18szbuildudptelegramssii (gatewayfunctions.cpp:396) ==28211== 0x41ae7c: __libc_csu_init (elf-init.c:88) ==28211== 0x5676a94: (below main) (in /lib64/libc-2.19.so)
the same message appears, except line *
appears different file name. other thing notice, line 28 of file gatewayfunctions.h
static string array declaration, array used in 2 files only. suggestions ?
Comments
Post a Comment