tong / hxssl

Haxe→C++/Neko OpenSSL bindings
30 stars 45 forks source link

Memory Leak with loadNekoAPI #31

Open hexonaut opened 10 years ago

hexonaut commented 10 years ago

9c4550df60f415ef877d94e54f19a552f557bc0f creates a memory leak that occurs on initialization. This is not obvious for most applications because they are usually only initialized once. However, this creates a major memory leak for tora applications.

I'm a little unsure of what the code does so I don't want to make any changes.

@tong Can you clarify?

tong commented 10 years ago

i've copied the loadNekoAPI function from one of hughs libraries in order to get the ndll working with neko when built with the hxcpp buildtool. i am not surewhy it isn't working without. i am not happy with this as the resulting ndll is bigger in size but having 2 ndll files for cpp and neko also sucks, so i am not sure how to proceed here.

hexonaut commented 10 years ago

Right well I haven't used hxcpp much so my experience with it is limited. I've found that by reversing the changes made in that commit allows neko to function correctly without the memory leak.

I wasn't able to track down the exact cause of the memory leak, but perhaps we can address it without removing hxcpp buildtool support.

hexonaut commented 10 years ago

Oh and additionally the neko_init function is being called twice due to the static variable initialization order. moduleInit is null the first time load() is called then gets assigned to false at a later point.