On Wed, 2003-02-26 at 07:45, Alfredo Valles wrote:
> Scott James Remnant wrote:
>
> >Altho to be honest, I can't see why any program would have a large array
> >on the *STACK*!
> >
> > {
> > int *a, i;
> >
> > a = malloc(sizeof(int) * 2048);
> > for (i = 0; i < 2048; i++)
> > a[i] = 2 * i;
> > }
> >
> >
> >"a" itself is on the stack, using only sizeof(int *) bytes. The "array"
> >it points to is on the heap.
> >
> I didn't know that space allocated with malloc resides in the heap, but
> it's not a common practice in large calculation programs to do that, I
> asure you. Remember many of us came from FORTRAN. It's much easier to
> define a big array and just begin to use it.
>
Sloppy programming deserves a bug report against that package, not a
complaint against a system safeguard.
> >
> > {
> > char a[8388608L];
> > }
> >
> >That's 8MB on the stack!
> >
> >Sounds more like a bug in the program to me, 8MB is more than enough
> >stack for anything I can think of!
> >
> Then obviously you haven't programed a big neural net, or a weather
> simulation, or ....
>
I've programmed many things, enormous arrays on the stack in C are a
sign of a bad programmer. Allocating space on the heap allows you to
catch in your code "out of memory" errors, without falling flat on your
face.
> >An unlimited stack would let
> >infinite-recursions carry away until they took down the system, at least
> >8MB stops them before they go too far.
> >
> After I set stack to unlimited I made the test of runing a program that
> use so big arrays that would left the system out of RAM, just to see
> what happen, but to my surpprice the kernel protect itself and kill the
> offender program. So this limit is really unnecesary.
>
You were lucky. The kernel's process killer is a notoriously
psychopathic :)
> >>Mixed would be a kind of mix of a testing debian system with the very
> >>latest soft compiled on the fly with a system like the one Gentoo has. I
> >>understand that Debian has some tools to generate a .deb package from
> >>sources using a custom script, so it shouldn't be so difficult to add
> >>dependency resolution capabilities to this system, and make this beauty
> >>available in Debian too.
> >>
> >>
> >>
> >You're describing exactly what happens in unstable for the majority of
> >other architectures. Maintainers upload an i386 package, the
> >autobuilders automatically build the package for the rest.
> >
> >It works, it's what we do.
> >
> So debian already have a system like the Gentoo's Portage?
>
Yes, it's called "apt and dpkg". Want to take unstable things and build
them from source just like you do in Gentoo?
Either:
1) Use Gentoo and stop complaining that Debian isn't Gentoo.
2) Do this:
# echo "deb-src http://ftp.debian.org/debian/ unstable main" >> /etc/apt/sources.list
# apt-get update
# apt-get build-dep package1
# apt-get source -b package1
# dpkg -i package1*.deb
Scott
--
Scott James Remnant Have you ever, ever felt like this? Had strange
http://netsplit.com/ things happen? Are you going round the twist?
Attachment:
signature.asc
Description: This is a digitally signed message part