[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linrad] Re: Memory leakage



Dear Joe,

> In valgrind's terminology, "lost memory" is synonymous with a "memory
> leak" - memory which has been malloc'ed but not free'ed.  In general, the
> operating system will reclaim this memory when the program terminates -
> you do not necessarily need to wait until the next reboot. 
Oooh! My problem is that some memory is lost each time I
start Linrad - but it happens only in X11 calls to initiate things
or in calls opening threads. Under normal usage of Linrad, threads 
are opened only when commands are given at the main menu so it does not
matter much if a few kilobytes are lost if the operating system will be 
able to reclaim memory after Linrad termination:-)

For obvious reasons I have not forgotten to free the large memory areas
properly in Linrads normal memory reallocations on the fly. (forgetting
causes errors due to "no more memory available"....) 

>  That being said, it might be possible for you to ask (possibly
> indirectly) X to allocate memory and then linrad could exit and leave X
> "holding the bag" so to speak.   In that case, the memory might not be
> reclaimed until X is restarted.  I am not particularly familiar with X
> programming, but that can be an issue with libraries in general.   Once, I
> missed a note buried deep in the comments of a header file.  It read
> something like:
If I can assume that lost memory is reclaimed by the os at program
exit or at some suitable time afterwords (daily?) I can just forget
the whole issue:-)

> /*pointer pBlarg allocated by foo(), you must free this with free()*/
> 
> That cost me a week of debugging time!  There could be some similar
> documentation for an X library function.
This is exactly what I meant by asking the question.
Is there a "free", "remove" or "destroy" command that 
I should issue but that I have not found in the small
pieces of documentation I happened to find? The answer seems
to be NO. Why bother about small memory leaks as long as they
are cleaned up at program exit :-)

73

Leif




#############################################################
This message is sent to you because you are subscribed to
  the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to  <linrad-request@xxxxxxxxxxxxxxxxxxxxx>

LINRADDARNIL