Browse Source

AdjustAmountOfExternalAllocatedMemory() for PixelArray

v1.x
Tj Holowaychuk 14 years ago
parent
commit
13b1c00647
  1. 13
      src/PixelArray.cc

13
src/PixelArray.cc

@ -128,16 +128,23 @@ PixelArray::PixelArray(int width, int height):
}
/*
* Allocate / zero data buffer.
* Allocate / zero data buffer. Hint mem adjustment.
*/
uint8_t *
PixelArray::alloc() {
_data = (uint8_t *) malloc(length());
memset(_data, 0, length());
int len = length();
_data = (uint8_t *) malloc(len);
memset(_data, 0, len);
V8::AdjustAmountOfExternalAllocatedMemory(len);
return _data;
}
/*
* Hint mem adjustment.
*/
PixelArray::~PixelArray() {
V8::AdjustAmountOfExternalAllocatedMemory(-length());
free(_data);
}

Loading…
Cancel
Save