Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver memory leak? #104

Closed
bubnenkoff opened this issue Apr 19, 2017 · 5 comments
Closed

Driver memory leak? #104

bubnenkoff opened this issue Apr 19, 2017 · 5 comments

Comments

@bubnenkoff
Copy link

Hi! I can't find the reason of why my app do not release memory. Here is topic http://forum.dlang.org/post/aluvxaltjkoojxuthswc@forum.dlang.org

I checked most of possible variants and even tried to call GC.collect();, but app still continue eat and do not release memory.

My code do not use nothing expect your driver. So I can assume that the driver is reason (but I am not sure).

The size of data set with I am working is about 400k rows.

Could you please do any test on your PC?

I tried to do call result.close(); in every loop iteration.

	foreach(item; getTablesGPSSensorList) // iterate pairs gps-sensor. getTablesGPSSensorList is array of Tuples (tables of DB).
	{			
		string itemName = format("GPS: %s | Sensor: %s", item.gps, item.sensor);
		ResultRange result = mysqlconnection.query(sqlquery.replace(`historygps_xxx`, item.gps).replace(`historysensor_xxx`, item.sensor));
@bubnenkoff
Copy link
Author

bubnenkoff commented Apr 19, 2017

Yes, it's seems that there is issue in driver. It's do not release memory...
My full code https://gist.github.com/bubnenkoff/f6c0a0b7088292e25186dc030846b70f

@Abscissa
Copy link

I'm afraid that without a complete (all-inclusive), reduced test case that I can just compile & run locally straight out-of-the-box, there isn't a whole lot I can personally do to dig into this.

However, for various reasons, I strongly suspect you're hitting issues with false pointers. This seems especially likely because (based on #100) you appear to be using a 32-bit exe for handling large amounts of data. Since D's garbage collector is not yet a "precise GC", processing lots of data in a 32-bit build makes false pointers (and therefore memory leaks) very likely.

I recommend building your program as a 64-bit instead of 32-bit, and see if that helps alleviate the problem. In theory, you should be able to do this by simply using the "-m64" flag when you run DMD. However, getting 64-bit support working right on Windows can sometimes be a little tricky, so if you have any troubles building a 64-bit D application, ask around on the newsgroup (I'm usually on Linux and was still using 32-bit back when I was developing on Windows, so I'm afraid I wouldn't be much help with that.)

@bubnenkoff
Copy link
Author

Thanks! I will try on monday!

@bubnenkoff
Copy link
Author

You are right!!
I checked. If build app on Windows with:
dub -a=x86_64 all works fine even error #100

@Abscissa
Copy link

FWIW, the reason #100 goes away when building for 64-bit is because optlink only supports 32-bit (it's also Windows-only). So when building for 64-bit on Windows, optlink isn't used at all, the Microsoft linker is used instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants