beyondzzk / as3crypto

Automatically exported from code.google.com/p/as3crypto
0 stars 0 forks source link

Memory leak in Base64 encode #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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