Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oleksii Turkot
CrystFEL
Commits
d8115c2f
Commit
d8115c2f
authored
Feb 19, 2010
by
Thomas White
Browse files
Fix various exciting (and otherwise) memory leaks
parent
3542ac97
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/diffraction-gpu.c
View file @
d8115c2f
...
...
@@ -137,6 +137,7 @@ static cl_program load_program(const char *filename, cl_context ctx,
return
0
;
}
free
(
source
);
*
err
=
CL_SUCCESS
;
return
prog
;
}
...
...
@@ -329,6 +330,9 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
}
}
clEnqueueUnmapMemObject
(
gctx
->
cq
,
gctx
->
diff
,
diff_ptr
,
0
,
NULL
,
NULL
);
clEnqueueUnmapMemObject
(
gctx
->
cq
,
gctx
->
tt
,
tt_ptr
,
0
,
NULL
,
NULL
);
}
...
...
@@ -349,8 +353,8 @@ struct gpu_context *setup_gpu(int no_sfac, struct image *image,
/* Generate structure factors if required */
if
(
!
no_sfac
)
{
if
(
image
->
molecule
->
reflections
==
NULL
)
{
get_reflections_cached
(
image
->
molecule
,
if
(
molecule
->
reflections
==
NULL
)
{
get_reflections_cached
(
molecule
,
ph_lambda_to_en
(
image
->
lambda
));
}
}
...
...
@@ -413,13 +417,14 @@ struct gpu_context *setup_gpu(int no_sfac, struct image *image,
}
}
gctx
->
sfacs
=
clCreateBuffer
(
gctx
->
ctx
,
CL_MEM_READ_ONLY
|
CL_MEM_
USE
_HOST_PTR
,
CL_MEM_READ_ONLY
|
CL_MEM_
COPY
_HOST_PTR
,
sfac_size
,
sfac_ptr
,
&
err
);
if
(
err
!=
CL_SUCCESS
)
{
ERROR
(
"Couldn't allocate sfac memory
\n
"
);
free
(
gctx
);
return
NULL
;
}
free
(
sfac_ptr
);
gctx
->
tt_size
=
image
->
width
*
image
->
height
*
sizeof
(
cl_float
);
gctx
->
tt
=
clCreateBuffer
(
gctx
->
ctx
,
CL_MEM_WRITE_ONLY
,
gctx
->
tt_size
,
...
...
src/pattern_sim.c
View file @
d8115c2f
...
...
@@ -363,5 +363,10 @@ skip:
cleanup_gpu
(
gctx
);
}
free
(
image
.
det
.
panels
);
free
(
powder
);
free
(
image
.
molecule
->
reflections
);
free
(
image
.
molecule
);
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment