Need to revert Byte changes, AutoGCRoot is releasing memory too quickly on iOS
This commit is contained in:
@@ -29,8 +29,7 @@ namespace lime {
|
||||
|
||||
unsigned char *_data;
|
||||
int _length;
|
||||
value _pin;
|
||||
AutoGCRoot *_root;
|
||||
value *_root;
|
||||
value _value;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <hx/CFFIExt.h>
|
||||
#include <system/System.h>
|
||||
#include <utils/Bytes.h>
|
||||
|
||||
@@ -40,9 +39,8 @@ namespace lime {
|
||||
|
||||
_data = 0;
|
||||
_length = 0;
|
||||
_pin = 0;
|
||||
_root = 0;
|
||||
_value = 0;
|
||||
_root = 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -53,9 +51,8 @@ namespace lime {
|
||||
|
||||
_data = 0;
|
||||
_length = 0;
|
||||
_pin = 0;
|
||||
_root = 0;
|
||||
_value = 0;
|
||||
_root = 0;
|
||||
|
||||
Resize (size);
|
||||
|
||||
@@ -68,9 +65,8 @@ namespace lime {
|
||||
|
||||
_data = 0;
|
||||
_length = 0;
|
||||
_pin = 0;
|
||||
_root = 0;
|
||||
_value = 0;
|
||||
_root = 0;
|
||||
|
||||
Set (bytes);
|
||||
|
||||
@@ -83,9 +79,8 @@ namespace lime {
|
||||
|
||||
_data = 0;
|
||||
_length = 0;
|
||||
_pin = 0;
|
||||
_root = 0;
|
||||
_value = 0;
|
||||
_root = 0;
|
||||
|
||||
FILE_HANDLE *file = lime::fopen (path, "rb");
|
||||
|
||||
@@ -117,9 +112,8 @@ namespace lime {
|
||||
|
||||
_data = 0;
|
||||
_length = 0;
|
||||
_pin = 0;
|
||||
_root = 0;
|
||||
_value = 0;
|
||||
_root = 0;
|
||||
|
||||
Set (data);
|
||||
|
||||
@@ -128,15 +122,10 @@ namespace lime {
|
||||
|
||||
Bytes::~Bytes () {
|
||||
|
||||
if (_pin) {
|
||||
|
||||
EXT_unpin_buffer (_pin);
|
||||
|
||||
}
|
||||
|
||||
if (_root) {
|
||||
|
||||
delete _root;
|
||||
*_root = 0;
|
||||
free_root (_root);
|
||||
|
||||
}
|
||||
|
||||
@@ -171,7 +160,8 @@ namespace lime {
|
||||
if (!_value) {
|
||||
|
||||
_value = alloc_empty_object ();
|
||||
_root = new AutoGCRoot (_value);
|
||||
_root = alloc_root ();
|
||||
*_root = _value;
|
||||
|
||||
}
|
||||
|
||||
@@ -232,7 +222,8 @@ namespace lime {
|
||||
|
||||
if (_root) {
|
||||
|
||||
delete _root;
|
||||
*_root = 0;
|
||||
free_root (_root);
|
||||
|
||||
}
|
||||
|
||||
@@ -244,14 +235,11 @@ namespace lime {
|
||||
|
||||
if (!_root) {
|
||||
|
||||
_root = new AutoGCRoot (_value);
|
||||
|
||||
} else {
|
||||
|
||||
_root->set (_value);
|
||||
_root = alloc_root ();
|
||||
|
||||
}
|
||||
|
||||
*_root = _value;
|
||||
_length = val_int (val_field (bytes, id_length));
|
||||
|
||||
if (_length > 0) {
|
||||
@@ -295,7 +283,8 @@ namespace lime {
|
||||
|
||||
if (_root) {
|
||||
|
||||
delete _root;
|
||||
*_root = 0;
|
||||
free_root (_root);
|
||||
|
||||
}
|
||||
|
||||
@@ -310,13 +299,6 @@ namespace lime {
|
||||
|
||||
if (_value) {
|
||||
|
||||
if (!_pin && HAS_pin_buffer ()) {
|
||||
|
||||
buffer b = val_to_buffer (val_field (_value, id_b));
|
||||
_pin = EXT_pin_buffer (b);
|
||||
|
||||
}
|
||||
|
||||
return _value;
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user