prefetching leaked memory

master
leitner 21 years ago
parent 0c138d14d8
commit e92d4ca5f5

@ -11,6 +11,7 @@ void iob_prefetch(io_batch* b,uint64 bytes) {
for (; e<last; ++e) { for (; e<last; ++e) {
if (e->type==FROMFILE) { if (e->type==FROMFILE) {
char* c,* d; char* c,* d;
uint64 before=bytes;
if (e->n>=1000000) { if (e->n>=1000000) {
d=c=mmap(0,bytes,PROT_READ,MAP_SHARED,e->fd,(e->offset|4095)+1); d=c=mmap(0,bytes,PROT_READ,MAP_SHARED,e->fd,(e->offset|4095)+1);
if (c!=MAP_FAILED) { if (c!=MAP_FAILED) {
@ -21,7 +22,7 @@ void iob_prefetch(io_batch* b,uint64 bytes) {
(void)x; (void)x;
} }
} }
munmap(c,bytes); munmap(c,before);
} }
return; return;
} }

Loading…
Cancel
Save