in reply to making perl more forgetting

Perl is optimized to doing things fast, even at the expensive of using more memory. Under the hood, lots and lots of things happen, and Perl isn't going to waste time "erasing" memory it's no longer using.
Is there any workaround to this except me writing another XS module providing
I don't think so, and even if you're going to write C, it may be harder to than you think. Compiler might eliminate code whose effect isn't going to be seen. A year or two ago I read an article about someone who had a simalar problem as yours - but then in C. He had sensitive information in a string, and after using it, he "cleared" the content by assigning to it another string of appropriate length. However, the compiler had noticed that after the assignment, the memory wouldn't be accessed anymore - so it just optimized the assignment away.

C is probably your best option though, just make sure the compiler doesn't outsmart you.

Abigail

Replies are listed 'Best First'.
Re: Re: making perl more forgetting
by dragonchild (Archbishop) on May 17, 2004 at 12:26 UTC
    It sounds like the only solution that is guaranteed is to use ASM and/or a C compiler with optimizing turned off. (Is there an Inline::ASM?)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      Well, it might be easier to write your code in such a way that the optimizer can't optimize it away the overwriting of the memory - for instance, by reading it back and doing something with those results. (Of course, you still might be outsmarted by your OS - if you're unlucky your rewrites won't go futher than the cache before the program is terminated, and the memory pages invalidated).

      Abigail