git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7713
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
struct list *next;
register size_t log;
struct list *next;
register size_t log;
+ /* Work even if the user was stupid enough to ask a 0-byte block, ie return a valid block that can be realloced or freed
+ * glibc malloc does not use this trick but return a constant pointer, but my hack is quicker to implement ;)
+ */
mdp = MD_TO_MDP (md);
LOCK(mdp);
mdp = MD_TO_MDP (md);
LOCK(mdp);
- printf("(%s) Mallocing %d bytes on %p (default: %p)...",xbt_thread_self_name(),size,mdp,__mmalloc_default_mdp);fflush(stdout);
+// printf("(%s) Mallocing %d bytes on %p (default: %p)...",xbt_thread_self_name(),size,mdp,__mmalloc_default_mdp);fflush(stdout);
if (mdp -> mmalloc_hook != NULL) {
if (mdp -> mmalloc_hook != NULL) {
/* No free fragments of the desired size, so get a new block
and break it into fragments, returning the first. */
UNLOCK(mdp);
/* No free fragments of the desired size, so get a new block
and break it into fragments, returning the first. */
UNLOCK(mdp);
- printf("(%s) No free fragment...",xbt_thread_self_name());
+ //printf("(%s) No free fragment...",xbt_thread_self_name());
result = mmalloc (md, BLOCKSIZE);
result = mmalloc (md, BLOCKSIZE);
- printf("(%s) Fragment: %p...",xbt_thread_self_name(),result);
+ //printf("(%s) Fragment: %p...",xbt_thread_self_name(),result);
LOCK(mdp);
if (result == NULL)
{
LOCK(mdp);
if (result == NULL)
{
mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
mdp -> heapstats.bytes_free -= blocks * BLOCKSIZE;
}
mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
mdp -> heapstats.bytes_free -= blocks * BLOCKSIZE;
}
- printf("(%s) Done mallocing. Result is %p\n",xbt_thread_self_name(),result);fflush(stdout);
+ //printf("(%s) Done mallocing. Result is %p\n",xbt_thread_self_name(),result);fflush(stdout);
UNLOCK(mdp);
return (result);
}
UNLOCK(mdp);
return (result);
}