[Geany] do not open oversize files
Krzysztof Żelechowski
giecrilj at xxxxx
Thu Jan 6 07:16:06 UTC 2011
Dnia czwartek, 6 stycznia 2011 o 00:35:16 Lex Trotman napisał(a):
> > On Tue, 4 Jan 2011 22:05:52 +0100
> > Krzysztof Żelechowski <giecrilj at stegny.2a.pl> wrote:
> >
> >> > > I do not know where you got it from, but the last OS I know that
> >> > > behaved like that was MacOS 7. [cut]
> >> >
> >> > Like what?..
> >>
> >> Like necessarily allocating a contiguous block of physical memory.
> >
> > What a strange idea... Unless your CPU lacks MMU, of course.
> >
> >> GNU malloc uses mmap so it is all virtual.
> >
> > mmap for large blocks and heap for small blocks IIRC, and naturally, the
> > heap itself is mmap-ed.
>
> But what does windows do?? Don't want more differences between
> versions to maintain.
Windows uses HeapAlloc or VirtualAlloc. However, what you need to know probably is what your run-time library does, not what Microsoft Windows does. The situation with RTL under Microsoft Windows is that there are various vendors and we cannot expect much consistency among them. Of course you can say Geany should be compiled by MinGW — but I would rather not require that.
>
> >
> >> > If by "01 << 040" you mean 4GB, how much real and virtual memory do
> >> > you have?
> >> >
> >> >
> >>
> >> I have 1 GB of physical memory. (01 << 040) is the first integer that does not fit into unsigned int.
> >
> > So then, using more than 4GB _will_ be a problem on your system, QED.
> > I pointed out it's a rough check.
> >
> > But if your malloc() fails on 4GB, and not below that, you either have
> > an unusually large swap file, or your kernel is set to always
> > overcommit. With the defaults, the check works much better.
>
> And you have a 64 bit kernel.
Guilty as charged :-)
Cheers,
Chris
More information about the Users
mailing list