Skip to content

JavaScript heap out of memory  #5

@W-went

Description

@W-went

I have a lot of images in one psd
I check code the err in this rgb.coffee
function combineRgbChannel will return big Array
maybe Array is Memory too big and cannot be freed

module.exports =
setRgbChannels: ->
@channelsinfo = [
{id: 0}
{id: 1}
{id: 2}
]

@channelsInfo.push {id: -1} if @channels() is 4

combineRgbChannel: ->
rgbChannels = @channelsinfo
.map (ch) -> console.log(ch);ch.id
.filter (ch) -> ch >= -1 # Mask data is -2
console.log(rgbChannels)
for i in [0...@numPixels]
r = g = b = 0
a = 255
for chan, index in rgbChannels
val = @channelData[i + (@channelLength * index)]

    switch chan
      when -1 then a = val
      when 0 then  r = val
      when 1 then  g = val
      when 2 then  b = val

  @pixelData.push r, g, b, a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions