Skip to content

Pool*Arrays leaks #223

Open
Open
@bruvzg

Description

@bruvzg

Pool arrays created in gdscript and passed to gdnative module are leaking. Or am I missing something and pool arrays should be freed manually?

gdnative module code:

void GDNObj::set_data(const PoolByteArray p_data) {

	if (p_data.size() == 0)
		return;

	if (data)
		std::free(data);

	data = std::malloc(p_data.size());
	std::memcpy(data, p_data.read().ptr(), p_data.size());
}

gdscript code:

func _ready():
	var gdn_obj = GDNObj.new()
	var bytes = PoolByteArray([0x41, 0x00, ... , 0x74, 0x00])
	gdb_obj.set_data(bytes)

Results in following error message at exit:

ERROR: cleanup: There are still MemoryPool allocs in use at exit!
   At: core/dvector.cpp:70.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis has been identified as a bugneeds testing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions