# Dgraph takes all disk space in windows

**URL:** <https://discuss.dgraph.io/t/dgraph-takes-all-disk-space-in-windows/12494>\
**Category:** Badger\
**Tags:** dgraph, status:accepted, kind:bug, ticket:created\
**Created:** [January 27, 2021, 5:09pm UTC](https://discuss.dgraph.io/t/dgraph-takes-all-disk-space-in-windows/12494 "2021-01-27T17:09:03Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![maaft](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maaft](https://discuss.dgraph.io/u/maaft)\
**Post date:** [February 11, 2021, 3:25pm UTC](https://discuss.dgraph.io/t/dgraph-takes-all-disk-space-in-windows/12494/14 "2021-02-11T15:25:08Z")

</div>

Quick Fix here:  
dgraph → posting/index.go:590

Change to:

```auto
dbOpts := badger.DefaultOptions(tmpIndexDir).
		WithSyncWrites(false).
		WithNumVersionsToKeep(math.MaxInt32).
		WithLogger(&x.ToGlog{}).
		WithCompression(options.None).
		WithEncryptionKey(x.WorkerConfig.EncryptionKey).
		WithLoggingLevel(badger.WARNING).
		WithInMemory(true).WithDir("").WithValueDir("")

```

Note the last line. This will use InMemory for the temporary badger instance and the error does not appear.

To reproduce the bug:

```auto
package main

import (
	"os"
	"path/filepath"

	"github.com/dgraph-io/badger/v3"
)

func main() {

	tmpIndexDir := filepath.Join(".", "test")
	b, err := badger.Open(badger.DefaultOptions(tmpIndexDir))
	if err != nil {
		panic(err)
	}

	err = b.Close()
	if err != nil {
		panic(err)
	}

	err = os.RemoveAll(tmpIndexDir)

	if err != nil {
		panic(err)
	}

}

```

@Naman maybe you got an idea? I saw you’ve fixed a possible related [bug](http://discuss.hypermode.com/t/unable-to-delete-the-mem-file-when-closing-the-db-under-windows-10-20h2/12353)

---

_[View the full topic](https://discuss.dgraph.io/t/dgraph-takes-all-disk-space-in-windows/12494)._
