Page 3 of 4

Memory Leak In SMaterialLayer

Posted: Wed Apr 20, 2011 6:59 am
by wlion
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;

Posted: Thu Jun 02, 2011 6:06 pm
by RainBoy
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

Posted: Fri Jun 03, 2011 5:11 pm
by RainBoy
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/irrlich ... ht_Test.7z

Thank you,
Alex.

Posted: Tue Jun 28, 2011 12:19 pm
by baol
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?

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

Posted: Sat Aug 13, 2011 4:56 pm
by mrpostiga
IXMLReader not implemented. please implement it...

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

Posted: Thu Jan 05, 2012 9:26 pm
by RainBoy
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...

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

Posted: Fri Jan 06, 2012 10:01 am
by IrrDelphi
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 :)

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

Posted: Fri Jan 06, 2012 2:26 pm
by RainBoy
check your PM please -)

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

Posted: Fri Jan 06, 2012 4:28 pm
by RainBoy
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 =)

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

Posted: Sun Apr 29, 2012 8:18 am
by Römer123
Hi,
I've got a question. How I should drop the ,,engine" from the irrKlang demos.

Code: Select all

 
drop_gcc(engine); // delete engine
 
In the irrKlang_130b is no drop_gcc :?

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

Posted: Sun Apr 29, 2012 8:22 am
by Römer123
Here is the answer:

Code: Select all

 
irrKlangDrop(engine);
 

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

Posted: Tue May 01, 2012 2:41 pm
by IrrDelphi
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

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

Posted: Sun Jun 03, 2012 11:44 pm
by sesilla
Hi IrrDelphi,

is possible to use headers with Freepascal on Mac OSX?

Thanks in advance
Sesilla

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

Posted: Wed Jun 06, 2012 5:18 pm
by IrrDelphi
No, Windows only

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

Posted: Mon Aug 19, 2013 3:31 pm
by Aeternitas
Hi,

I am a programmer in language Lazarus, what is Delphi alike. I tried to use teh irrDelphi in Lazarus and I got the following errors:

Code: Select all

Irrlicht_172_enum.pas(83,2) Note: Values in enumeration types have to be ascending
Irrlicht_172_enum.pas(941,59) Note: Values in enumeration types have to be ascending
Irrlicht_172_enum.pas(1115,68) Note: Values in enumeration types have to be ascending
Irrlicht_172_enum.pas(1291,106) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,119) Error: Illegal expression
Irrlicht_172_enum.pas(1291,119) Note: Values in enumeration types have to be ascending
Irrlicht_172_enum.pas(1291,129) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,142) Error: Illegal expression
Irrlicht_172_enum.pas(1291,153) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,166) Error: Illegal expression
Irrlicht_172_enum.pas(1291,178) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,191) Error: Illegal expression
Irrlicht_172_enum.pas(1291,206) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,219) Error: Illegal expression
Irrlicht_172_enum.pas(1291,228) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,241) Error: Illegal expression
Irrlicht_172_enum.pas(1291,254) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,267) Error: Illegal expression
Irrlicht_172_enum.pas(1291,278) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,291) Error: Illegal expression
Irrlicht_172_enum.pas(1291,303) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,316) Error: Illegal expression
Irrlicht_172_enum.pas(1291,329) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,343) Error: Illegal expression
Irrlicht_172_enum.pas(1291,359) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,373) Error: Illegal expression
Irrlicht_172_enum.pas(1291,393) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,407) Error: Illegal expression
Irrlicht_172_enum.pas(1291,417) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,431) Error: Illegal expression
Irrlicht_172_enum.pas(1291,446) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,460) Error: Illegal expression
Irrlicht_172_enum.pas(1291,476) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,490) Error: Illegal expression
Irrlicht_172_enum.pas(1291,504) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,518) Error: Illegal expression
Irrlicht_172_enum.pas(1291,534) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,548) Error: Illegal expression
Irrlicht_172_enum.pas(1291,561) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,575) Error: Illegal expression
Irrlicht_172_enum.pas(1291,596) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,610) Error: Illegal expression
Irrlicht_172_enum.pas(1291,619) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,633) Error: Illegal expression
Irrlicht_172_enum.pas(1291,644) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,658) Error: Illegal expression
Irrlicht_172_enum.pas(1291,679) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,693) Error: Illegal expression
Irrlicht_172_enum.pas(1291,733) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,759) Error: Illegal expression
Irrlicht_172_enum.pas(1291,771) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,797) Error: Illegal expression
Irrlicht_172_enum.pas(1291,808) Error: Incompatible types: got "<enumeration type>" expected "Int64"
Irrlicht_172_enum.pas(1291,834) Error: Illegal expression
Irrlicht_172_enum.pas(1291,834) Fatal: There were 50 errors compiling module, stopping
Can you help me run the Irrlicht in Lazarus?