mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-27 03:30:13 +01:00
intel: Free memory before inserting bo into cache.
This has the unfortunate behaviour of releasing our malloc cache, but the alternative is for X to consume a couple of gigabytes of ram and die during testing. Fortunately the extra mallocs have little impact on performance whereas avoiding swap and death, lots. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
792fed1e24
commit
57473c7f52
1 changed files with 10 additions and 3 deletions
|
|
@ -727,9 +727,6 @@ drm_intel_gem_bo_free(drm_intel_bo *bo)
|
|||
if (bo_gem->gtt_virtual)
|
||||
munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
|
||||
|
||||
free(bo_gem->reloc_target_bo);
|
||||
free(bo_gem->relocs);
|
||||
|
||||
/* Close this object */
|
||||
memset(&close, 0, sizeof(close));
|
||||
close.handle = bo_gem->gem_handle;
|
||||
|
|
@ -788,6 +785,16 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, time_t time)
|
|||
DBG("bo_unreference final: %d (%s)\n",
|
||||
bo_gem->gem_handle, bo_gem->name);
|
||||
|
||||
/* release memory associated with this object */
|
||||
if (bo_gem->reloc_target_bo) {
|
||||
free(bo_gem->reloc_target_bo);
|
||||
bo_gem->reloc_target_bo = NULL;
|
||||
}
|
||||
if (bo_gem->relocs) {
|
||||
free(bo_gem->relocs);
|
||||
bo_gem->relocs = NULL;
|
||||
}
|
||||
|
||||
bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, bo->size);
|
||||
/* Put the buffer into our internal cache for reuse if we can. */
|
||||
tiling_mode = I915_TILING_NONE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue