9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] How to use strdup()?
@ 1998-11-13 14:52 forsyth
  0 siblings, 0 replies; 5+ messages in thread
From: forsyth @ 1998-11-13 14:52 UTC (permalink / raw)


>>I'm facing memory problem in news reader having
>>more than 2000 unread articles which
>>uses the strdup() more than 2000 times, and 
>>then  fails in malloc. 

it probably means i didn't consider closely enough when to free
the string passed to plinitlabel etc, and never noticed the program
growing.  i think most of the other strdup'd values are freed correctly.

as several people have said, the result of strdup must
be freed explicitly somewhere.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [9fans] How to use strdup()?
@ 1998-11-16 11:00 Bengt
  0 siblings, 0 replies; 5+ messages in thread
From: Bengt @ 1998-11-16 11:00 UTC (permalink / raw)


> It's mainly my part in making tcs(1) to library.

greetings,

is tcs, the unix version, considered "free"? may i use it if i remember to keep
copyright notices and such?


Best Wishes, Bengt
===============================================================
Everything aforementioned should be regarded as totally private
opinions, and nothing else. bengt@softwell.se
``His great strength is that he is uncompromising. It would make
him physically ill to think of programming in C++.''




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [9fans] How to use strdup()?
@ 1998-11-16  8:12 Kenji
  0 siblings, 0 replies; 5+ messages in thread
From: Kenji @ 1998-11-16  8:12 UTC (permalink / raw)


> >>I'm facing memory problem in news reader having
> >>more than 2000 unread articles which
> >>uses the strdup() more than 2000 times, and 
> >>then  fails in malloc. 
> 
> it probably means i didn't consider closely enough when to free
> the string passed to plinitlabel etc, 

No!
It's mainly my part in making tcs(1) to library.  It's expensive to
convert ISO-2022-JP to utf or vise versa.  I'm now in the process of updating
this, however, it's hard enough to me. :-)  Many strange behaviour have I.

Kenji





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [9fans] How to use strdup()?
@ 1998-11-13  1:12 Scott
  0 siblings, 0 replies; 5+ messages in thread
From: Scott @ 1998-11-13  1:12 UTC (permalink / raw)


okamoto@granite.cias.osakafu-u.ac.jp writes:
| strdup(2) uses malloc(2), but does not free it.
| When the malloced memory space will be freed?

You'll need to free each string when you know
it is no longer in use.

Anyone ported Bohem's garbage collector to Plan 9?

Alternatively, anyone ported Limbo to Plan 9? :-)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [9fans] How to use strdup()?
@ 1998-11-13  1:00 okamoto
  0 siblings, 0 replies; 5+ messages in thread
From: okamoto @ 1998-11-13  1:00 UTC (permalink / raw)


strdup(2) uses malloc(2), but does not free it.
When the malloced memory space will be freed?

I'm facing memory problem in news reader having
more than 2000 unread articles which
uses the strdup() more than 2000 times, and 
then  fails in malloc. 

Is this mean not to use strdup() in that situation?

Kenji




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-11-16 11:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-13 14:52 [9fans] How to use strdup()? forsyth
  -- strict thread matches above, loose matches on Subject: below --
1998-11-16 11:00 Bengt
1998-11-16  8:12 Kenji
1998-11-13  1:12 Scott
1998-11-13  1:00 okamoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).