Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Mourad Boufarguine
Hi Stefan,

Commenting the line _vertices-unref(); (line 276 in VertexGeometry.cpp),
seems to solve the problem for me. I think you do not need to unreference
_vertices manually.
Besides that, I got some weird behaviour with some examples using multiple
screens, calling _viewer-setUpViewOnSingleScreen(0) in the constructor of
sx::Scene seems to solve this.

Regards,
Mourad

On Thu, Dec 10, 2009 at 9:54 AM, Simon Hammett
s.d.hamm...@googlemail.comwrote:

 2009/12/10 Chris 'Xenon' Hanson xe...@alphapixel.com

 On 12/10/2009 12:00 AM, Andreas Goebel wrote:
  Hi,
  you get heap corruption on windows if (not only if, but if) you mix
  different system libraries, static runtime and dynamic runtime, or debug
  dlls and release dlls.

   You can get it that way too.

  Make really sure that your release build uses release libraries only,
  and vice versa.

   Usually the linker will yell and scream at you if you try to do this, so
 it usually
 doesn't happen accidentally and without the programmer knowing.


 No it doesn't, symbol mangling isn't different between debug/release
 builds.
 (though that might be a handy option)

 You won't get linker errors unless you've got methods or functions
 deffed in/out depending on your build config.

 Maybe we should add some funcs to the OSG libs, based on the config
 to stop beginners accidentally mixing builds.

 Mind you the error message from mixing release/builds is different
 from the OPs screen shot. It usually says something about a memory
 block not being in the heap.

 --
 http://www.ssTk.co.uk

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Jean-Sébastien Guay

Hi Chris,


  Usually the linker will yell and scream at you if you try to do this, so it 
usually
doesn't happen accidentally and without the programmer knowing.


I'm curious when you've seen the linker scream about mixing debug and 
release DLLs... I've seen plenty of users do it by mistake and the 
linker never said a thing, except when mixing the dynamic and static C 
runtimes. When mixing debug and release (both using the dynamic runtime, 
for example) the linker says nothing.


That's why it's so easy to do, but nevertheless it will lead to bad 
behavior, crashes, etc.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Roger James




Jean-Sbastien Guay wrote:
Hi
Chris,
  
  
   Usually the linker will yell and scream at
you if you try to do this, so it usually

doesn't happen accidentally and without the programmer knowing.

  
  
I'm curious when you've seen the linker scream about mixing debug and
release DLLs... I've seen plenty of users do it by mistake and the
linker never said a thing, except when mixing the dynamic and static C
runtimes. When mixing debug and release (both using the dynamic
runtime, for example) the linker says nothing.
  
  
That's why it's so easy to do, but nevertheless it will lead to bad
behavior, crashes, etc.
  

It is usually more of muted cough than a scream, and is often a warning
referring to conflicting default libraries. If the least significant
bits of the address of the corruption remain the same then you can
track it down it down with a data breakpoint. Because of heap
randomisation you need to work out what the base address of the heap is
for each run and recalculate the address of the breakpoint each time.
If you use an absolute address "0xabcd etc" and make sure it is one
of the first four breakpoints then a hardware breakpoint register will
be used and the program will run at a reasonable speed. You may get a
few false positives if the breakpoint is enabled too soon but you
should be able to sort that out :-)

Roger


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Chris 'Xenon' Hanson
On 12/10/2009 1:54 AM, Simon Hammett wrote:
 No it doesn't, symbol mangling isn't different between debug/release builds.
 (though that might be a handy option)

  That's true, but I'm pretty sure that last time I made that mistake, the 
linker DID
issue a warning that was recognizable (with some Googling) as quit mixing 
debug and
release builds.

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Chris 'Xenon' Hanson
On 12/10/2009 7:11 AM, Jean-Sébastien Guay wrote:
 I'm curious when you've seen the linker scream about mixing debug and
 release DLLs... I've seen plenty of users do it by mistake and the
 linker never said a thing, except when mixing the dynamic and static C
 runtimes. When mixing debug and release (both using the dynamic runtime,
 for example) the linker says nothing.

  I'll try to check, but since it's something I carefully avoid now, it may be 
a while.

  I liked the idea about intentionally messing with the code so that it 
wouldn't link if
you messed it up, but it seems infeasible that you could prevent every 
combination of
mismatch. I often see it when mixing libs compiled by a third party anyway.

 J-S


-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Jean-Sébastien Guay

Hi Chris,


  I'll try to check, but since it's something I carefully avoid now, it may be 
a while.


Well as Roger said, it's generally something like conflicting default 
libraries. But when someone who doesn't really know they shouldn't do 
that runs their project and it seems to work until it crashes while 
incrementing an iterator or something like that, they generally don't 
suspect that warning to be related to the problem. Plus some just ignore 
warnings altogether... As if the compiler was just being too fussy in 
telling you these things... :-)


To be clear, I agree the linker says something, but I don't think it's 
near vocal enough to be useful to newbies / newcomers to Windows (on 
Linux you can mix debug and release however you want, no problem).



  I liked the idea about intentionally messing with the code so that it 
wouldn't link if
you messed it up, but it seems infeasible that you could prevent every 
combination of
mismatch.


I agree, it would be nice. I don't see it as a problem that we can't 
catch every single type of mismatch... If we can at least catch some 
it's better than it is now. Just like the osgPlugins-version scheme 
was added to make it harder to mix plugins from different versions of 
OSG, but you can always put all the plugins in the same directory as the 
executable and then you're essentially defeating the scheme that's 
trying to protect you.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Chris 'Xenon' Hanson
On 12/10/2009 10:07 AM, Jean-Sébastien Guay wrote:
 To be clear, I agree the linker says something, but I don't think it's
 near vocal enough to be useful to newbies / newcomers to Windows (on
 Linux you can mix debug and release however you want, no problem).

  Well, agreed. I remember it said something and eventually I figured out what 
it meant.

  We could add it to the Wiki Windows build notes?

 I agree, it would be nice. I don't see it as a problem that we can't
 catch every single type of mismatch... If we can at least catch some
 it's better than it is now. Just like the osgPlugins-version scheme
 was added to make it harder to mix plugins from different versions of
 OSG, but you can always put all the plugins in the same directory as the
 executable and then you're essentially defeating the scheme that's
 trying to protect you.

  I can't picture how to do it in any fashion. Do you have a recommendation for 
how to
implement it?

 J-S


-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread stefan)
Thanks everybody for the input. Special thanks mourad. I too though I
was having some issues with mixing libraries. The problem was really
ruling out that cause of the heap corruption. Not even after compiling
every support library from scratch I was sure there is not some other
windows idiosyncrasy I don't know about. So, many thanks for finding
this bug. Release 0.4.2 is out. Everything runs smooth. I am very
happy.
http://labs.nortd.com/sx/

Many Thanks,
/stefan

On Thu, Dec 10, 2009 at 10:25 AM, Mourad Boufarguine
mourad.boufargu...@gmail.com wrote:
 Hi Stefan,

 Commenting the line _vertices-unref(); (line 276 in VertexGeometry.cpp),
 seems to solve the problem for me. I think you do not need to unreference
 _vertices manually.
 Besides that, I got some weird behaviour with some examples using multiple
 screens, calling _viewer-setUpViewOnSingleScreen(0) in the constructor of
 sx::Scene seems to solve this.

 Regards,
 Mourad

 On Thu, Dec 10, 2009 at 9:54 AM, Simon Hammett s.d.hamm...@googlemail.com
 wrote:

 2009/12/10 Chris 'Xenon' Hanson xe...@alphapixel.com

 On 12/10/2009 12:00 AM, Andreas Goebel wrote:
  Hi,
  you get heap corruption on windows if (not only if, but if) you mix
  different system libraries, static runtime and dynamic runtime, or
  debug
  dlls and release dlls.

  You can get it that way too.

  Make really sure that your release build uses release libraries only,
  and vice versa.

  Usually the linker will yell and scream at you if you try to do this, so
 it usually
 doesn't happen accidentally and without the programmer knowing.

 No it doesn't, symbol mangling isn't different between debug/release
 builds.
 (though that might be a handy option)

 You won't get linker errors unless you've got methods or functions
 deffed in/out depending on your build config.

 Maybe we should add some funcs to the OSG libs, based on the config
 to stop beginners accidentally mixing builds.

 Mind you the error message from mixing release/builds is different
 from the OPs screen shot. It usually says something about a memory
 block not being in the heap.

 --
 http://www.ssTk.co.uk

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread stefan)
hey Xenon,

I just wanted to comment on the naming issue. I am not really in the
position to just rename our project but I can moderate.

I can see your initial concern but also feel  SceneExpression is
quite different from Scene Express both in the way the word visually
looks and the meaning. Please note the former is written as one word.

What's more important is that the audience/clients are totally
different. Maybe you can clarify but from reading the website you sent
me, Scene Express is an addon to a end user software product. On the
other hand, SceneExpression is an open source programming framework
for programmers. I doubt the users of the framework and the software
product will ever overlap. This and the fact that they cater to
different activities makes me think they will never really be mixed
up. They are also in no way competing projects.

Please consider,
Thanks,

/stefan


On Thu, Dec 10, 2009 at 1:36 AM, Chris 'Xenon' Hanson
xe...@alphapixel.com wrote:
 On 12/9/2009 5:09 PM, stefan) wrote:
 So, we have been working on this open source, osg-based app framework
 for linux, osx, and windows. It's a fun project but on windows (only!)
 it is still acting up. We get this super-undescriptive non-fatal
 pop-up:
 windows has triggered a breakpoint
 this may be due to corruption of the heap
 See: http://sceneexpression.googlecode.com/files/vs-issue.png
 After clicking Continue a couple of times the app runs fine just
 like on the other platforms. What we would be most interested in, are
 there typical causes for this in regard to osg?

  Well, I can't comment on relating to OSG, but this is usually going to be 
 related to
 memory overruns. Are you in a debug build? The debug builds have extra 
 padding on
 allocation (guard regions) that are checked at various times. If the guard 
 regions are
 damaged, the compiler will warn you, but it's non-fatal because the guard 
 region took the
 hit instead of your real data. But it is a REAL error, because in a non-debug 
 build your
 real data would have probably been trashed.

  Tools like valgrind on Linux might point out the same issue, if it exists on 
 Linux.

  I'd start by examining code _prior_ to the exception. The exception is 
 telling you the
 damage has been done, but basically triggers AFTER the offending code.

 If any of you feel super-helpful and want to give the project a quick spin:
 http://labs.nortd.com/sx/downloads/
 A long guide is here:
 http://code.google.com/p/sceneexpression/wiki/GettingStartedOnWindows


  I do have a favor to ask. Your project is called Scene Expression, and 
 that's kind of
 uncomfortably close to a tool my company makes called Scene Express:
 http://www.google.com/search?q=scene+expressie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a

  which incorporates an OSG-based landscape viewer (NatureView Express) and 
 has been
 around since 2003: http://3dnature.com/history.html

  Would you mind considering changing the name of your toolkit to something a 
 little more
 different from my company's product?


  I'm interested in your project as I have considered doing an OSG application 
 framework
 myself at times. Yours seems a little different than the goals I wanted to 
 pursue, but it
 looks very nice for what you're trying to accomplish.


 Any hint very much appreciated,
 Best,
 /stefan


 --
 Chris 'Xenon' Hanson, omo sanza lettere                  Xenon AlphaPixel.com
 PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
 There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-10 Thread Chris 'Xenon' Hanson
On 12/10/2009 3:06 PM, stefan) wrote:
 hey Xenon,
 I just wanted to comment on the naming issue. I am not really in the
 position to just rename our project but I can moderate.
 I can see your initial concern but also feel  SceneExpression is
 quite different from Scene Express both in the way the word visually
 looks and the meaning. Please note the former is written as one word.
 What's more important is that the audience/clients are totally
 different. Maybe you can clarify but from reading the website you sent
 me, Scene Express is an addon to a end user software product. On the
 other hand, SceneExpression is an open source programming framework
 for programmers. I doubt the users of the framework and the software
 product will ever overlap. This and the fact that they cater to
 different activities makes me think they will never really be mixed
 up. They are also in no way competing projects.

  I guess I have to disagree here. If I created a userspace application called 
something
like OpenSceneGraphics and used a different font, I suspect Robert would still 
be a bit
peeved. The fact that both Scene Express (which we also abbreviate SX, like you 
do) and
SceneExpression use OSG sort of inevitably drags them into a common arena. At 
heart, they
both do realtime 3D graphics. Trademark law pretty much requires a trademark 
holder like
me defend my mark against anything that overlaps it, otherwise I lose my 
rights. The
litmus test is whether a person who could come into contact with both products 
might
become confused about which was which, which went with which company, or 
whether they
might think they were the same. A taxi company called Boost, a programming 
library called
Boost and an energy shake called Boost aren't a problem. But two realtime 3D 
tools can be
a problem.

  If there was a meat supplier that sold frozen hamburger patties (instead of 
ready-made
fast-food meals) called BurgerKingGuy, Burger King would still ask them to stop 
using such
a similar name. Because they are at heart, still doing similar things and using 
a similar
name.

  I don't mean to be difficult about it, and I'm trying to be polite and 
reasonable. But,
my company and trademark law require me to defend my product trademarks. If I 
don't, I
lose all rights to them and any competitor of mine can use them without any 
objection.

 Thanks,
 /stefan

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Trouble porting to vs2008, heap corruption

2009-12-09 Thread stefan)
So, we have been working on this open source, osg-based app framework
for linux, osx, and windows. It's a fun project but on windows (only!)
it is still acting up. We get this super-undescriptive non-fatal
pop-up:

windows has triggered a breakpoint
this may be due to corruption of the heap
See: http://sceneexpression.googlecode.com/files/vs-issue.png

After clicking Continue a couple of times the app runs fine just
like on the other platforms. What we would be most interested in, are
there typical causes for this in regard to osg?

We had a really hard time narrowing down the code that causes it
because a) we are new to vs2008 b) when we followed the stack trace
and uncommented the line causing the problem, the next line would act
up next and so on.

If any of you feel super-helpful and want to give the project a quick spin:
http://labs.nortd.com/sx/downloads/

It's all self-contained. You download, unpack, cmake in-source, open
sceneExpression.sln, run, for example, shapesExample by
right-clicking/Debug/StartNewInstance.

A long guide is here:
http://code.google.com/p/sceneexpression/wiki/GettingStartedOnWindows

Any hint very much appreciated,
Best,
/stefan
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-09 Thread Chris 'Xenon' Hanson
On 12/9/2009 5:09 PM, stefan) wrote:
 So, we have been working on this open source, osg-based app framework
 for linux, osx, and windows. It's a fun project but on windows (only!)
 it is still acting up. We get this super-undescriptive non-fatal
 pop-up:
 windows has triggered a breakpoint
 this may be due to corruption of the heap
 See: http://sceneexpression.googlecode.com/files/vs-issue.png
 After clicking Continue a couple of times the app runs fine just
 like on the other platforms. What we would be most interested in, are
 there typical causes for this in regard to osg?

  Well, I can't comment on relating to OSG, but this is usually going to be 
related to
memory overruns. Are you in a debug build? The debug builds have extra padding 
on
allocation (guard regions) that are checked at various times. If the guard 
regions are
damaged, the compiler will warn you, but it's non-fatal because the guard 
region took the
hit instead of your real data. But it is a REAL error, because in a non-debug 
build your
real data would have probably been trashed.

  Tools like valgrind on Linux might point out the same issue, if it exists on 
Linux.

  I'd start by examining code _prior_ to the exception. The exception is 
telling you the
damage has been done, but basically triggers AFTER the offending code.

 If any of you feel super-helpful and want to give the project a quick spin:
 http://labs.nortd.com/sx/downloads/
 A long guide is here:
 http://code.google.com/p/sceneexpression/wiki/GettingStartedOnWindows


  I do have a favor to ask. Your project is called Scene Expression, and that's 
kind of
uncomfortably close to a tool my company makes called Scene Express:
http://www.google.com/search?q=scene+expressie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a

  which incorporates an OSG-based landscape viewer (NatureView Express) and has 
been
around since 2003: http://3dnature.com/history.html

  Would you mind considering changing the name of your toolkit to something a 
little more
different from my company's product?


  I'm interested in your project as I have considered doing an OSG application 
framework
myself at times. Yours seems a little different than the goals I wanted to 
pursue, but it
looks very nice for what you're trying to accomplish.


 Any hint very much appreciated,
 Best,
 /stefan


-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-09 Thread Andreas Goebel
Hi,

you get heap corruption on windows if (not only if, but if) you mix
different system libraries, static runtime and dynamic runtime, or debug
dlls and release dlls.

Make really sure that your release build uses release libraries only,
and vice versa.

Regards, Andreas
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble porting to vs2008, heap corruption

2009-12-09 Thread Chris 'Xenon' Hanson
On 12/10/2009 12:00 AM, Andreas Goebel wrote:
 Hi,
 you get heap corruption on windows if (not only if, but if) you mix
 different system libraries, static runtime and dynamic runtime, or debug
 dlls and release dlls.

  You can get it that way too.

 Make really sure that your release build uses release libraries only,
 and vice versa.

  Usually the linker will yell and scream at you if you try to do this, so it 
usually
doesn't happen accidentally and without the programmer knowing.

  But it is worth checking.

 Regards, Andreas

-- 
Chris 'Xenon' Hanson, omo sanza lettere  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
There is no Truth. There is only Perception. To Perceive is to Exist. - Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org