Add test for memory alocation
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
		@@ -32,6 +32,8 @@ public:
 | 
			
		||||
 | 
			
		||||
	Ref<Texture2D> get_tex_value();
 | 
			
		||||
	void set_tex_value(Ref<Texture2D> tex);
 | 
			
		||||
	void start();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@ void Test::_bind_methods() {
 | 
			
		||||
	ClassDB::bind_method(D_METHOD("get_tex_value"), &Test::get_tex_value);
 | 
			
		||||
	ClassDB::bind_method(D_METHOD("set_tex_value", "tex"), &Test::set_tex_value);
 | 
			
		||||
	ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tex_value", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_tex_value", "get_tex_value");
 | 
			
		||||
	ClassDB::bind_method(D_METHOD("start"), &Test::start);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int Test::get_i_value() {
 | 
			
		||||
@@ -52,3 +53,20 @@ Ref<Texture2D> Test::get_tex_value() {
 | 
			
		||||
void Test::set_tex_value(Ref<Texture2D> tex) {
 | 
			
		||||
	tex_value = tex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Test::start() {
 | 
			
		||||
	Node3D *node3d = memnew_arr(Node3D, 100);
 | 
			
		||||
 | 
			
		||||
	uint64_t *i = (uint64_t *)memalloc(sizeof(uint64_t));
 | 
			
		||||
 | 
			
		||||
	uint64_t *node3d_size = (uint64_t *)node3d - 1;
 | 
			
		||||
 | 
			
		||||
	for (*i = 0; *i < *node3d_size; *i = *i + 1) {
 | 
			
		||||
		UtilityFunctions::print(&node3d[*i]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	UtilityFunctions::print(*node3d_size);
 | 
			
		||||
	memdelete_arr(node3d);
 | 
			
		||||
	memdelete(i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user