A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
check if free on fragment already free
[simgrid.git]
/
src
/
xbt
/
mmalloc
/
mfree.c
diff --git
a/src/xbt/mmalloc/mfree.c
b/src/xbt/mmalloc/mfree.c
index
64e0982
..
b264ec3
100644
(file)
--- a/
src/xbt/mmalloc/mfree.c
+++ b/
src/xbt/mmalloc/mfree.c
@@
-11,6
+11,7
@@
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "mmprivate.h"
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "mmprivate.h"
+#include "xbt/ex.h"
/* Return memory to the heap.
Like `mfree' but don't call a mfree_hook if there is one. */
/* Return memory to the heap.
Like `mfree' but don't call a mfree_hook if there is one. */
@@
-39,8
+40,7
@@
void mfree(struct mdesc *mdp, void *ptr)
switch (type) {
case -1: /* Already free */
switch (type) {
case -1: /* Already free */
- fprintf(stderr,"Asked to free a fragment in a block that is already free. I'm puzzled\n");
- abort();
+ THROWF(system_error, 0, "Asked to free a fragment in a block that is already free. I'm puzzled\n");
break;
case 0:
break;
case 0:
@@
-151,6
+151,10
@@
void mfree(struct mdesc *mdp, void *ptr)
/* Set size used in the fragment to 0 */
frag_nb = RESIDUAL(ptr, BLOCKSIZE) >> type;
/* Set size used in the fragment to 0 */
frag_nb = RESIDUAL(ptr, BLOCKSIZE) >> type;
+
+ if( mdp->heapinfo[block].busy_frag.frag_size[frag_nb] == 0)
+ THROWF(system_error, 0, "Asked to free a fragment that is already free. I'm puzzled\n");
+
mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = 0;
if (mdp->heapinfo[block].busy_frag.nfree ==
mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = 0;
if (mdp->heapinfo[block].busy_frag.nfree ==