kolombet/as3crypto

Memory leak in Base64 encode

Opened this issue · 0 comments

Hi, I found a memory leak in the Base64 encode function. I have a program that 
does several encodes per second, and found out that after a little while, it 
would take a lot of memory (much more than it should) After profiling I found 
out that the Base64.encodeByteArray function was responsible. I resolved the 
problem by using static vars for dataBuffer and _outputBuffer and reseting the 
length of databuffer to 0 rather than creating a new Array.

There are probably similar problems in the decode function, I will look into it 
aswell.

Original issue reported on code.google.com by benjis...@gmail.com on 9 Dec 2011 at 8:03