lua-users home
lua-l archive

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


I am using Lua in my game engine and want to use my own memory allocator.
The problem is that Lua seems to call the allocation function with pointers that are not managed by my own memory manager.

Is this behaviour wanted? Is there a way I can work around this behaviour?

Here follows the output which shows how the allocation function is called at runtime. The very last call
fails because the pointer is unknown to my memory manager.

I0928 21:34:42.631222  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 40
I0928 21:34:42.631222 5579 MemoryManager.h:244] RAW: Allocating 40 bytes for 40 objects of type char in pool 2 I0928 21:34:42.631222 5579 MemoryManager.h:263] RAW: Allocated 40 bytes at address 0x1046480 in pool 2 (0x1044190)

I0928 21:34:42.631284  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 25
I0928 21:34:42.631284 5579 MemoryManager.h:244] RAW: Allocating 25 bytes for 25 objects of type char in pool 2 I0928 21:34:42.631284 5579 MemoryManager.h:263] RAW: Allocated 25 bytes at address 0x1046500 in pool 2 (0x1044190)

I0928 21:34:42.631319  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 27
I0928 21:34:42.631319 5579 MemoryManager.h:244] RAW: Allocating 27 bytes for 27 objects of type char in pool 2 I0928 21:34:42.631319 5579 MemoryManager.h:263] RAW: Allocated 27 bytes at address 0x1046580 in pool 2 (0x1044190)

I0928 21:34:42.631353  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 32
I0928 21:34:42.631353 5579 MemoryManager.h:244] RAW: Allocating 32 bytes for 32 objects of type char in pool 2 I0928 21:34:42.631353 5579 MemoryManager.h:263] RAW: Allocated 32 bytes at address 0x1046600 in pool 2 (0x1044190)

I0928 21:34:42.631384  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 64
I0928 21:34:42.631384 5579 MemoryManager.h:244] RAW: Allocating 64 bytes for 64 objects of type char in pool 2 I0928 21:34:42.631384 5579 MemoryManager.h:263] RAW: Allocated 64 bytes at address 0x1046680 in pool 2 (0x1044190)

I0928 21:34:42.631408  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 0
I0928 21:34:42.631417  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 40
I0928 21:34:42.631417 5579 MemoryManager.h:244] RAW: Allocating 40 bytes for 40 objects of type char in pool 2 I0928 21:34:42.631417 5579 MemoryManager.h:263] RAW: Allocated 40 bytes at address 0x1046700 in pool 2 (0x1044190)

I0928 21:34:42.631443  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 40
I0928 21:34:42.631443 5579 MemoryManager.h:244] RAW: Allocating 40 bytes for 40 objects of type char in pool 2 I0928 21:34:42.631443 5579 MemoryManager.h:263] RAW: Allocated 40 bytes at address 0x1046780 in pool 2 (0x1044190)

I0928 21:34:42.631468  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 31
I0928 21:34:42.631468 5579 MemoryManager.h:244] RAW: Allocating 31 bytes for 31 objects of type char in pool 2 I0928 21:34:42.631468 5579 MemoryManager.h:263] RAW: Allocated 31 bytes at address 0x1046800 in pool 2 (0x1044190)

I0928 21:34:42.631491  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 40
I0928 21:34:42.631491 5579 MemoryManager.h:244] RAW: Allocating 40 bytes for 40 objects of type char in pool 2 I0928 21:34:42.631491 5579 MemoryManager.h:263] RAW: Allocated 40 bytes at address 0x1046880 in pool 2 (0x1044190)

I0928 21:34:42.631515  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 39
I0928 21:34:42.631515 5579 MemoryManager.h:244] RAW: Allocating 39 bytes for 39 objects of type char in pool 2 I0928 21:34:42.631515 5579 MemoryManager.h:263] RAW: Allocated 39 bytes at address 0x1046900 in pool 2 (0x1044190)

I0928 21:34:42.631541  5579 Allocator.cpp:21] ALLOC
ptr: 0
osize: 0
nsize: 160
I0928 21:34:42.631541 5579 MemoryManager.h:244] RAW: Allocating 160 bytes for 160 objects of type char in pool 2 I0928 21:34:42.631541 5579 MemoryManager.h:263] RAW: Allocated 160 bytes at address 0x10478b0 in pool 2 (0x1044190)

I0928 21:34:42.631574  5579 Allocator.cpp:21] ALLOC
ptr: 0x1045ad0
osize: 80
nsize: 0
I0928 21:34:42.631574 5579 MemoryManager.h:178] RAW: Deallocating 80 bytes (address: 0x1045ad0, 80 objects of type char) I0928 21:34:42.631682 5579 MemoryManager.cpp:102] Pointer 0x1045ad0 not found in any of the registered memory pools