On 1 November 2012 13:34, Jatin Bodarya <jatin.boda...@elitecore.com> wrote: > For example, is it actually necessary to dynamically > allocate memory within the 'getfield' routine? > This is then parsed as a decimal number, and > then released immediately. > > ->> yes as the original CSV file is very dynamically change its data ,I > suppose to use this method.
No - that's not what I meant. I was suggesting you compare the current 3 x getfield() (involving malloc + assorted strchr, etc) 3 x strtol() 2 x free() (plus the memory leak from not releasing 'index'!) vs a single statement along the lines of sscanf( tmp, "%d,%d,%d", &index, &inOctets, &outOctets ); I'm talking about the way that you read in and parse the data at a given point in time - not how dynamic the data file is. Dave ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders