Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix allocation error #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

abraidwood
Copy link

This code has the same allocation error that mine had - that "t" can be greater than the block-size. When this happens, insufficient memory is allocated

@fengdh
Copy link
Owner

fengdh commented Jul 7, 2015

Thank your for your patch. I prefer to allocate necessary memory directly to a while loop:

      require: function(n) {
        if (l - c < n) {
          var buf2 = new bufType(l += blockSize * Math.ceil( (l - c + n ) / blockSize ));
          buf2.set(buf);
          buf = buf2;
        }
        c += n;
        return buf;
      },  

I will update my port of minilzo-decompress later.

Sometime decompressed buffer size is known, it is better to have a option to assign it ahead in your implementation.

Thanks a lot for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants