Re: [gtk-list] Re: Gtk--: Tracking down clobbered pointers and mysterious crashes





> > ... once I changed this to dynamic allocation everything
> > worked OK again ... while the individual Gtk-- objects may be small,
> > I do this (stack allocation) all over the Gui which totals up to quite a lot
> > of objects ...
>
> allocating everything in stack has one bad consiquence - you will get
> less memory protection, since they're all in continuous memory area
> where the application has access to. Thus other parts of your program
> might mess up (with pointer trickery and arrays) parts of the other
> data. With dynamic mem allocation, there'll be spreaded some bytes in
> address space which are protected - minor pointer errors gets revealed
> much easier.

OK, that explains a lot. I noticed that in my current program (terraform),
pointer mistakes don't always core dump right away ... I attributed
this to an implementation difference between C and C++, but the
whole stack thing explains what's going on ...

Thanks a lot
--> R




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]