in reply to Re^2: Perl, C and deallocation responsibility (Returning Memory back to the OS References)
in thread Perl, C and deallocation responsibility

Thanks for the info!
I haven't seen memory go back to the O/S, but I haven't had the need to look closely on Win 10. The last time I got really anxious about memory was when developing a Perl application for Win XP. I had a memory budget for that one. Often for Perl applications, I see memory usage approach a limit in an asymptotic way and then just stay flat forever. Of course, mileage varies a lot depending on the application's needs.

I think in the context of the OP's question, one question is whether anybody is going to do anything to either free or reuse the memory allocated for the char*. I was happy to have found an explicit statement about what is going to happen if the listed memory allocation routine is used. I was and am not at all clear what actually happens with the char* declaration (instead of an SV that Perl will reference count upon). There is obviously some type mangling that happens underneath the covers, but I'm not sure how.

BTW, I have found that SQLite is very good at returning memory if you adjust its memory usage during run time. Giving an SQL indexing operation a lot of memory can have a huge positive performance effect. And then shrink down memory size for normal usage.

  • Comment on Re^3: Perl, C and deallocation responsibility