Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #10621

Re: Small question with respect to scope and performace

From sravanreddy001 <sravanreddy001@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Small question with respect to scope and performace
Date 2011-09-30 19:31 -0700
Organization http://groups.google.com
Message-ID <2700668.317.1317436313608.JavaMail.geo-discussion-forums@yqlb4> (permalink)
References <27725376.29.1317422561029.JavaMail.geo-discussion-forums@yqbu18>

Show all headers | View raw


[THERE ARE MANY QUESTIONS. PLEASE REPLY TO ANYTHING YOU WANT TO.]
[THANKS IN ADVANCE.]

Hi Noah,Richard:

Both your answers were helpful for my understanding.

Noah: True, I'm working in some performance issues and dealing with lot of small files.. 
 total of 150,000 files, and creating multiple vectors in each iteration.

The amount memory I'm saving is very less may be around 10 MB.. max 15 MB not more than that..

But, my applications starts and grows over 500MB.
I'm thinking there might some memory leak, or its equivalent.

How could that be?

most of my code structure is like this.


for(i=0;i<150000;i++){
 vector<string> data;

// read from files, store into data.
//and write 'data' to another file.

}


QUESTION:  Is it mandatory to erase the contents in the next loop, or this is automatically handled by compiler/runtime/OS.

working in unix. I'm also creating soo many strings like

string str = //some source;

are these also released after each run?

--> At some places, I'm reading file in one go. by creating memory using 'malloc'. Should this be released explicitly?


If any one of you can help me with similar stuff, please drop a mail to sravanreddy001 @ gmail.com  I wont bother you

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Small question with respect to scope and performace sravanreddy001 <sravanreddy001@gmail.com> - 2011-09-30 15:42 -0700
  Re: Small question with respect to scope and performace Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-30 19:22 -0400
  Re: Small question with respect to scope and performace Noah Roberts <roberts.noah@gmail.com> - 2011-09-30 15:51 -0700
  Re: Small question with respect to scope and performace sravanreddy001 <sravanreddy001@gmail.com> - 2011-09-30 19:31 -0700
    Re: Small question with respect to scope and performace Richard Damon <news.x.richarddamon@xoxy.net> - 2011-09-30 23:14 -0400

csiph-web