jtsiomb / kdtree

A simple C library for working with KD-Trees
http://nuclear.mutantstargoat.com/sw/kdtree/
Other
395 stars 115 forks source link

free_nodes have a memory leak using node allocator #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Port the library to MSCV environment as static library (MT and MD).
2. Use windows threads to allocate and free the result nodes.
3. Debug displayed memory leaks with no details.

What is the expected output? What do you see instead?
-Expected: No memory leaks using allocator.
-Just one of many (Memory leak of 24bytes at 0x057f8ae0) 

What version of the product are you using? On what operating system?
kd-tree lib 0.55/MS Windows XP 

Please provide any additional information below.
I tracked the leak and found that the free_nodes global static variable is
not freed after the use. So

I have solve the problem (added a clear free_node when freeing the kdtree
if there are free_nodes), I will send the code to the project owner the
modifications and the ported code If he/she wants. I've also test the code
in MinGW. Further unitary testing is required. 

Thank you for the lib is very useful. 
I'm new to this Google code stuff, so If I've made any mistake I beg your
pardon. Just needed to contact with the owner and collaborate.

Regards.

Original issue reported on code.google.com by rixiomor...@gmail.com on 21 Dec 2009 at 7:44

GoogleCodeExporter commented 9 years ago
This is not a memory leak. It works as intended, the lifetime of the allocator 
pool is supposed to be the same as the application. The resources are reclaimed 
by the operating system on exit.

Original comment by jtsi...@gmail.com on 25 Nov 2011 at 12:12