 			char *d_sql;
 			cudaMalloc((void**)&d_sql, sqlLength);
 			cudaMemcpy(d_sql, firstCmd, sqlLength, cudaMemcpyHostToDevice);
-			D_DATA(&_data); d_main_ShellExec<<<1,1>>>(_data.D_, d_sql); H_DATA(&_data);
+			D_DATA(&_data); d_main_ShellExec<<<1,1>>>(_data.D_, d_sql); cudaErrorCheck(cudaDeviceHeapSynchronize(_deviceHeap)); H_DATA(&_data);
 			cudaFree(d_sql);
 			H_RETURN(); if (h_return) return h_return;
 #else

	//cudaErrorCheck(cudaSetDeviceFlags(cudaDeviceMapHost | cudaDeviceLmemResizeToMax));
	int deviceId = gpuGetMaxGflopsDeviceId();
	cudaErrorCheck(cudaSetDevice(deviceId));
	cudaErrorCheck(cudaDeviceSetLimit(cudaLimitStackSize, 1024*5));
	_deviceHeap = cudaDeviceHeapCreate(256, 4096);
	cudaErrorCheck(cudaDeviceHeapSelect(_deviceHeap));
	//
	D_DATA(&_data); d_MainInit_0<<<1,1>>>(_data.D_); H_DATA(&_data);
	cudaDeviceHeapSynchronize(_deviceHeap);
#else
	SysEx::Config(SysEx::CONFIG_URI, 1);

		data.ColWidth[2] = 58;
		data.Cnt = 0;
		char *errMsg = nullptr;
		Main::Exec(p->Ctx, "PRAGMA database_list;", ::Callback, &data, &errMsg);
		if (errMsg)
		{
			_fprintf(stderr,"Error: %s\n", errMsg);
