Mailinglist Archive: opensuse (1558 mails)
| < Previous | Next > |
Re: [opensuse] c question - how to tell how much memory you program/data structure uses?
- From: Per Jessen <per@xxxxxxxxxxxx>
- Date: Sat, 15 Aug 2009 11:06:25 +0200
- Message-id: <h65tqh$noj$1@xxxxxxxxxxxxxxxx>
David C. Rankin wrote:
There are libraries out there for profiling memory usage, but yours is a
hardly a complex case - yes, your memory usage will be something like
this:
#node*sizeof(struct record) + sum(length of lines).
An indexing engine? There must be something out there already.
/Per
--
Per Jessen, Zürich (21.4°C)
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
The file is read with lines length determined by "length = getline
(&lineptr, &n, depo)" with the char *line allocated as length+1 with
malloc. Is there a way to determine how much memory I'm using besides
doing some kind of sum on each node in the list where memory for each
node would be something like ( length*char + int + int + int + int +
int + pointer )? Or, could I just take something like the text file
size on disk + number of structures * ( int + int + int + int + int +
pointer )?
There are libraries out there for profiling memory usage, but yours is a
hardly a complex case - yes, your memory usage will be something like
this:
#node*sizeof(struct record) + sum(length of lines).
Also, more generally, for searching and working on the text, would
just all reading the text into something other than a linked list be
better? I guess I could use one big buffer. The text files for each
single transcript are rarely ever more than 500K. Eventually, I would
like to have the ability to search through any number of transcripts,
but they need not all be in memory at the same time (although for
speed that would help). Any text handling favorite data structures?
An indexing engine? There must be something out there already.
/Per
--
Per Jessen, Zürich (21.4°C)
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |