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