Notifications
Clear all

[Closed] PLY Import Plugin Glitch

I’m developing a PLY Import plugin for 3ds Max9 and Running into some trouble. it’s my first time working with the 3ds Max 9 SDK,a lthough I’ve been writing C/C++ code for years.

Before anyone brings up the HabWare plugin, let me debunk that 2 ways:

  1. The HabWare plugin has a pretty serious memory leak that when dealing with the size meshes we work with, crashes after just a few imports. I’ve fixed this memory leak in my code.
  2. The HabWare plugin only works with Max8.

Anyway, my plugin seems to work just fine. I can import PLY file after PLY file without any trouble. i’ve written a simple MAXScript to import each file in a directory of 500 PLY files, then delete each model. Memory usage remains constant and everything seems to work.

EXCEPT, for some unknown reason it crashes at random intervals. Sometimes I get 5 files and it crashes. Sometimes I get 150 files and it crashes. Sometimes it will run all 500 and not crash at all. I’ve been unable to trace it down, but from some debug print statements (logging to a file), it seems to crash upon returning to Max after the plugin is finished. I based my code on the provided OBJ Importer code, gutting all but the basic structure and puttingin my code. Is there anyone out there that can help me debug this? I’ll happily send you my VS2005 Project if you can help, or if anyone has any experience with “gotchas” that I should look for.

2 Replies

I had a similar bug and that sort of bug are hard to debug. The problem was in my code because some variables allocation/deallocation was bugged.

Where do your memory leak happen ? Watch in your call stack : maybe in assembly code (DLL).

Yannick

this might be due to new MaxHeapOperators in Max9

eq. you do something like:

ptr = malloc(...)
delete ptr;

crash !
sometimes, but not always, like you said

check also SDK-Help
section: What's New in 3ds Max 9 SDK - Memory Management
i you haven't already :)

PS: guruware.at has a Ply-Importer, if you wanna try…

*edit: my ply-thing was also crashing
solution: add Sleep(0) before leaving your plugin
now it works
weired…

its not on guruware-ste atm, it will be v0.95b, in case you want to try it
v0.9 will crash (sometimes)
take care