comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Memory leak in STRMID
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Memory leak in STRMID [message #92110 is a reply to message #92109] Wed, 14 October 2015 10:27 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, October 14, 2015 at 10:15:34 AM UTC-6, Chris Torrence wrote:
> On Wednesday, October 14, 2015 at 5:33:18 AM UTC-6, superchromix wrote:
>> I can confirm that the same behaviour occurs in IDL 8.5.
>>
>> nice catch
>>
>> Mark
>
> Hmmm, well, here's the comment I found in the strmid function:
>
> * NOTE: This routine does not re-allocate memory to hold the
> * shortened string in order to avoid unneccessary fragmentation
> * of virtual memory. It simply uses the existing string memory
> * (moving the trailing null character up) unless the resulting string is
> * null (in which case it is freed).
>
> So, bug? Feature? Undesirable side effect?
>
> -Chris

Okay, I fixed this.

Just FYI, this wasn't a "leak" - IDL was still keeping track of the memory, and doing a .reset would free up the memory.

STRMID now creates new strings of the correct length, regardless of whether the input strings are temporaries or not. This may lead to some memory fragmentation, but that's probably better than wasting a bunch of memory.

Thanks for reporting it!

-Chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Iterative reconstruction
Next Topic: Problem with .eps figure losing annotation in a LaTeX document

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 22:17:54 PDT 2025

Total time taken to generate the page: 0.56055 seconds