IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal headers

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Memory Leak In SMaterialLayer

Postby wlion » Wed Apr 20, 2011 6:59 am

There is another memory leak in Irrlicht_172.pas :

Code: Select all
SMaterialLayer  = record
..........
   TextureMatrix: Pmatrix4;    // <== may be change to "TextureMatrix: matrix4; " can prevent memory leak
..........
end;


Code: Select all
procedure SMaterialLayer.setTextureMatrix(const vMat: Pmatrix4);
begin
  if not Assigned(TextureMatrix) then begin
    New(TextureMatrix);       // <== will cause memory leak, only create, no dispose
    TextureMatrix^ := vMat^;
  end else
    TextureMatrix^ := vMat^;
end;
wlion
 
Posts: 2
Joined: Thu Apr 14, 2011 8:17 am

Postby RainBoy » Thu Jun 02, 2011 6:06 pm

I have a couple of memory leaks in the example 12:

Code: Select all

Call Stack Information:
--------------------------------------------------------------------------------------------------------
|Address |Module                 |Unit                   |Class             |Procedure/Method|Line     |
--------------------------------------------------------------------------------------------------------
|+Memory Leak: Type=Data; Total size=16; Count=1                                                       |
|------------------------------------------------------------------------------------------------------|
|00402EB4|12.TerrainRendering.exe|                       |                  |                |         |
|0047781F|12.TerrainRendering.exe|Irrlicht_172.pas       |                  |irrStrA         |20847[1] |
|0047787F|12.TerrainRendering.exe|Irrlicht_172.pas       |                  |irrStr          |20876[1] |
|004B25EF|12.TerrainRendering.exe|12.TerrainRendering.dpr|                  |Main            |229[160] |
|------------------------------------------------------------------------------------------------------|
|                                                                                                      |
|+Memory Leak: Type=Data; Total size=36; Count=1                                                       |
|------------------------------------------------------------------------------------------------------|
|00402F23|12.TerrainRendering.exe|                       |                  |                |         |
|00477851|12.TerrainRendering.exe|Irrlicht_172.pas       |                  |irrStrA         |20851[5] |
|0047787F|12.TerrainRendering.exe|Irrlicht_172.pas       |                  |irrStr          |20876[1] |
|004B25EF|12.TerrainRendering.exe|12.TerrainRendering.dpr|                  |Main            |229[160] |
|------------------------------------------------------------------------------------------------------|
|                                                                                                      |
|+Memory Leak: Type=ICustomReferenceCounted; Total size=36; Count=3                                    |
|------------------------------------------------------------------------------------------------------|
|0047796E|12.TerrainRendering.exe|Irrlicht_172.pas       |TVirtualParent    |Init            |21157[1] |
|00477D63|12.TerrainRendering.exe|Irrlicht_172.pas       |TCppClass         |Create          |23492[1] |
|00477E51|12.TerrainRendering.exe|Irrlicht_172.pas       |CDynamicMeshBuffer|Create          |23510[1] |
|004B2938|12.TerrainRendering.exe|12.TerrainRendering.dpr|                  |Main            |177[108] |
|------------------------------------------------------------------------------------------------------|
|                                                                                                      |
|+Memory Leak: Type=Data; Total size=1088; Count=64                                                    |
|------------------------------------------------------------------------------------------------------|
|00402EB4|12.TerrainRendering.exe|                       |                  |                |         |
|004775B9|12.TerrainRendering.exe|Irrlicht_172.pas       |                  |PatchVMTbyVMT   |20378[23]|
|0047762E|12.TerrainRendering.exe|Irrlicht_172.pas       |                  |PatchVMT        |20403[4] |
|00477D70|12.TerrainRendering.exe|Irrlicht_172.pas       |TCppClass         |Create          |23493[2] |
|00477E51|12.TerrainRendering.exe|Irrlicht_172.pas       |CDynamicMeshBuffer|Create          |23510[1] |
|004B2938|12.TerrainRendering.exe|12.TerrainRendering.dpr|                  |Main            |177[108] |
|------------------------------------------------------------------------------------------------------|
|                                                                                                      |
|+Memory Leak: Type=CVertexBuffer; Total size=36; Count=1                                              |
|------------------------------------------------------------------------------------------------------|
|00477E5F|12.TerrainRendering.exe|Irrlicht_172.pas       |CDynamicMeshBuffer|Create          |23511[2] |
|004B2938|12.TerrainRendering.exe|12.TerrainRendering.dpr|                  |Main            |177[108] |
|------------------------------------------------------------------------------------------------------|
|                                                                                                      |
|+Memory Leak: Type=CIndexBuffer; Total size=36; Count=1                                               |
|------------------------------------------------------------------------------------------------------|
|00477E74|12.TerrainRendering.exe|Irrlicht_172.pas       |CDynamicMeshBuffer|Create          |23512[3] |
|004B2938|12.TerrainRendering.exe|12.TerrainRendering.dpr|                  |Main            |177[108] |
|------------------------------------------------------------------------------------------------------|
|                                                                                                      |
|+Memory Leak: Type=Data; Total size=46137352; Count=1                                                 |
|------------------------------------------------------------------------------------------------------|
|00402F23|12.TerrainRendering.exe|                       |                  |                |         |
|00478425|12.TerrainRendering.exe|Irrlicht_172.pas       |CVertexBuffer     |reallocate      |23780[3] |
|00477E85|12.TerrainRendering.exe|Irrlicht_172.pas       |CDynamicMeshBuffer|Create          |23513[4] |
|------------------------------------------------------------------------------------------------------|
|                                                                                                      |
|+Memory Leak: Type=Data; Total size=22118408; Count=1                                                 |
|------------------------------------------------------------------------------------------------------|
|004065AA|12.TerrainRendering.exe|                       |                  |                |         |
|00478676|12.TerrainRendering.exe|Irrlicht_172.pas       |CIndexBuffer      |push_back_      |23906[12]|
--------------------------------------------------------------------------------------------------------


i'm trying to fix this problems
RainBoy
 
Posts: 14
Joined: Wed Jun 01, 2011 8:08 pm
Location: United States

Postby RainBoy » Fri Jun 03, 2011 5:11 pm

I've finished change part of code to prevent memory leaks
Please note that i've changed parts that really needed to me; this wrapper still have several 'memory leaks' routines.

Changed:

- Replace function IrrStr to procedure IrrStr;
Now you need to write something like this -

Code: Select all
strTerMap : PIrrString;
strTerMap := new(pIrrStringA);
irrStr('media\terrain-heightmap.bmp', strTerMap);
//.... working with strTermap
Dispose(strTerMap);


- Added TVMTManager class to calculate allocated memory in PatchVMTbyVMT procedure

It is possible that other examples should not work now; you need to change works with irrStr procedure.
Now i don't have any memory leaks in Example 12 - Terrain rendering.

You can download it here - http://dl.dropbox.com/u/3790498/irrlicht/Irrlicht_Test.7z

Thank you,
Alex.
RainBoy
 
Posts: 14
Joined: Wed Jun 01, 2011 8:08 pm
Location: United States

Postby baol » Tue Jun 28, 2011 12:19 pm

small fix
Irrlicht_172.pas line 12017
Code: Select all
function createDeviceEx(const parameters: SIrrlichtCreationParameters): PIrrlichtDevice; cdecl; external IRR_DLL;

params must be passed by ref
Code: Select all
   extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
      const SIrrlichtCreationParameters& parameters);

update to
Code: Select all
const parameters: PSIrrlichtCreationParameters

test
Code: Select all
function DeviceCreate(const deviceType: E_DRIVER_TYPE; const w, h, bits: Integer; const fullscreen, stencilbuffer, vsync: Boolean; const receiver: Pointer = nil): PIrrlichtDevice;
var
  params: SIrrlichtCreationParameters;
begin

  params.DeviceType := EIDT_BEST;
  params.DriverType := deviceType;
  params.WindowSize.Width := w;
  params.WindowSize.Height:= h;
  params.Bits := bits;
  params.ZBufferBits := bits;
  params.Fullscreen := fullscreen;
  params.Stencilbuffer := stencilbuffer;
  params.Vsync := vsync;
  params.AntiAlias := 0;
  params.WithAlphaChannel := false;
  params.Doublebuffer := true;
  params.IgnoreInput := false;
  params.Stereobuffer := false;
  params.HighPrecisionFPU := false;
  params.EventReceiver := receiver;
  params.WindowId := 0;
  params.LoggingLevel := ELL_INFORMATION;
  params.SDK_version_do_not_use := IRRLICHT_SDK_VERSION;

  result := createDeviceEx(@params);
  // get irrlicht imagebase for thiscall_ex
  IRR_IMAGEBASE := GetModuleHandle(IRR_DLL);
  // default
  dev := Result;
  if Assigned(dev) then begin
    drv     := dev.getVideoDriver;
    fs      := dev.getFileSystem;
    gui     := dev.getGUIEnvironment;
    smgr    := dev.getSceneManager;
    cur     := dev.getCursorControl;
    logger  := dev.getLogger;
    vidml   := dev.getVideoModeList;
    osop    := dev.getOSOperator;
    tmr     := dev.getTimer;
  end;
end;

and maybe rename deviceType to driverType?
baol
 
Posts: 1
Joined: Tue Jun 28, 2011 12:11 pm

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby mrpostiga » Sat Aug 13, 2011 4:56 pm

IXMLReader not implemented. please implement it...
mrpostiga
 
Posts: 1
Joined: Sat Aug 13, 2011 4:54 pm

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby RainBoy » Thu Jan 05, 2012 9:26 pm

Looks like this project does not have any support now...
I have a strange problem.
I'm using code similar to the terrain sample.
My project creates terrain, shows it. After that user closes this view (all objects disposed) and reopen new terrain
I can open terrain 1 time without any problem, but when i tried to reopen other terrans 2..6 times my application crashes with "problem in external dll at address...."
Someone has the same problem? Dn how i can fix it...
RainBoy
 
Posts: 14
Joined: Wed Jun 01, 2011 8:08 pm
Location: United States

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby IrrDelphi » Fri Jan 06, 2012 10:01 am

RainBoy wrote:Looks like this project does not have any support now...
I have a strange problem.
I'm using code similar to the terrain sample.
My project creates terrain, shows it. After that user closes this view (all objects disposed) and reopen new terrain
I can open terrain 1 time without any problem, but when i tried to reopen other terrans 2..6 times my application crashes with "problem in external dll at address...."
Someone has the same problem? Dn how i can fix it...

Irrlicht 172 latest version now.. no updates for headers. Attach source

mrpostiga wrote:IXMLReader not implemented. please implement it...

Can't do this.. IXMLReader used c++ language fithes which Delphi not have

baol wrote:small fix

Not necessary becouse it identical

baol wrote:and maybe rename deviceType to driverType?

Sure :)
Sorry for my bad english, it is not my primary language
IrrDelphi
 
Posts: 26
Joined: Tue Oct 13, 2009 10:59 am

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby RainBoy » Fri Jan 06, 2012 2:26 pm

check your PM please -)
RainBoy
 
Posts: 14
Joined: Wed Jun 01, 2011 8:08 pm
Location: United States

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby RainBoy » Fri Jan 06, 2012 4:28 pm

irrDelphi, please check your PM again
Looks like i Can't send PM to you, all of my 3 messages in "outbox"

my icq 138-639-871
skype kononov_alexey

sorry about some flood, guys =)
RainBoy
 
Posts: 14
Joined: Wed Jun 01, 2011 8:08 pm
Location: United States

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby Römer123 » Sun Apr 29, 2012 8:18 am

Hi,
I've got a question. How I should drop the ,,engine" from the irrKlang demos.
cpp Code: Select all
 
drop_gcc(engine); // delete engine
 


In the irrKlang_130b is no drop_gcc :?
Römer123
 
Posts: 6
Joined: Sun Apr 29, 2012 7:27 am
Location: Germany

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby Römer123 » Sun Apr 29, 2012 8:22 am

Here is the answer:
cpp Code: Select all
 
irrKlangDrop(engine);
 
Römer123
 
Posts: 6
Joined: Sun Apr 29, 2012 7:27 am
Location: Germany

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby IrrDelphi » Tue May 01, 2012 2:41 pm

Römer123 wrote:I've got a question. How I should drop the ,,engine" from the irrKlang demos.


Gcc version is experimental and buggy! Use vc version and irrKlangDrop() function
Sorry for my bad english, it is not my primary language
IrrDelphi
 
Posts: 26
Joined: Tue Oct 13, 2009 10:59 am

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby sesilla » Sun Jun 03, 2012 11:44 pm

Hi IrrDelphi,

is possible to use headers with Freepascal on Mac OSX?

Thanks in advance
Sesilla
sesilla
 
Posts: 2
Joined: Sat Apr 21, 2012 11:52 am

Re: IrrDelphi(Irrlicht 172, irrKlang 130b) Delphi\Pascal hea

Postby IrrDelphi » Wed Jun 06, 2012 5:18 pm

No, Windows only
Sorry for my bad english, it is not my primary language
IrrDelphi
 
Posts: 26
Joined: Tue Oct 13, 2009 10:59 am

Previous

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest