and i don't use cmem, because that one doesn't work for me (heaptrc always saying no Memory leaks), and i get a lot of corrupted memory from cmem.That is because you overlooked that heaptrc IS a memory manager by itself, so if you hook cmem, heaptrc won't work anymore.
No heaptrc in Uses-clause. I added it in Project-Options-Debugger (Dwarf2)and i don't use cmem, because that one doesn't work for me (heaptrc always saying no Memory leaks), and i get a lot of corrupted memory from cmem.That is because you overlooked that heaptrc IS a memory manager by itself, so if you hook cmem, heaptrc won't work anymore.
You can safely use heaptrc and if no leaks are detected change it to cmem. That's what heaptrc is designed for.
Just to be sure: you should let the compiler insert heaptrc and not put it in any uses clause.
The above problems can be wholly caused by mixing two different memory managers, so try first heaptrc without cmem and then with just cmem and without the heaptrc option set.
If there is still memory corruption we need to look further.
The reason I suspect this is the case is the following:
When the compiler inserts heaptrc it does so *before* anything else is done and heaptrc already allocates memory by itself to be able to register all memory allocations/de-allocations. (that's why it is done by the compiler! and not through a uses clause)
That memory is lost when you subsequently set a different memory manager: acute memory corruption.
#soft limits for a process/thread
ulimit -a
#hard limits for a process/thread
ulimit -Ha
I have tried to replicate your problem on win64 and Raspbian, but I used 3.2.0 and 3.3.1 (from today).Thaddy,
I have no problem using sqlite3 in any way, whatever memory manager I use.
Note that the Sqlite3 bindings in 3.2.0 and trunk have changed a bit to support threading in a better way.
Open a terminal; issue these commands and check how high is the stack size set in Ubuntu system.thx, will try that and report backQuote#soft limits for a process/thread
ulimit -a
#hard limits for a process/thread
ulimit -Ha
Then set the soft limit of a stack size for reasonable size eg. 512 (ulimit -s 512) and try to re-execute your program.
I have tried to replicate your problem on win64 and Raspbian, but I used 3.2.0 and 3.3.1 (from today).Thaddy,
I have no problem using sqlite3 in any way, whatever memory manager I use.
Note that the Sqlite3 bindings in 3.2.0 and trunk have changed a bit to support threading in a better way.
thx for that information. I'll postpone on SQLite-use until second half of the year then, when FPC320 becomes officially available
(not familiar with building from svn/trunk/wherever)
Open a terminal; issue these commands and check how high is the stack size set in Ubuntu system.thx, will try that and report backQuote#soft limits for a process/thread
ulimit -a
#hard limits for a process/thread
ulimit -Ha
Then set the soft limit of a stack size for reasonable size eg. 512 (ulimit -s 512) and try to re-execute your program.
zvoni@ZvoniLinux:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
zvoni@ZvoniLinux:~$ ulimit -Ha
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Maybe put that on the HeapTrc-Wiki: DON'T USE IT WITH ANY OTHER MEMORY-MANAGER.FYI: I just adapted the wiki and added a warning, but also a note how to handle alternative memory managers and heaptrc in the same codebase:
Open a terminal; issue these commands and check how high is the stack size set in Ubuntu system.thx, will try that and report backQuote#soft limits for a process/thread
ulimit -a
#hard limits for a process/thread
ulimit -Ha
Then set the soft limit of a stack size for reasonable size eg. 512 (ulimit -s 512) and try to re-execute your program.
My result on my machineCode: [Select]zvoni@ZvoniLinux:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
zvoni@ZvoniLinux:~$ ulimit -Ha
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
huh?Code: [Select]zvoni@ZvoniLinux:~$ ulimit -a
zvoni@ZvoniLinux:~$ ulimit -Ha
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimitedCode: [Select]core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
What does ulimit -Ha say?
Maybe put that on the HeapTrc-Wiki: DON'T USE IT WITH ANY OTHER MEMORY-MANAGER.FYI: I just adapted the wiki and added a warning, but also a note how to handle alternative memory managers and heaptrc in the same codebase:
http://wiki.freepascal.org/heaptrc
http://wiki.freepascal.org/heaptrc#Why_heaptrc_should_not_be_added_to_the_uses_clause_manually
huh?Code: [Select]zvoni@ZvoniLinux:~$ ulimit -a
zvoni@ZvoniLinux:~$ ulimit -Ha
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimitedCode: [Select]core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31133
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 31133
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
What does ulimit -Ha say?
stack size (kbytes, -s) 8192
Definitely no expert here, but why should i lower my Stack-size from 8196 KB to 512? (ulimit -s is for the "soft"-limit?!)
Oh sorry, I didn't see the ulimit -Ha part from the quote text field. :-[
It seems there is no limits. Please open a terminal in your program directory, execute ulimit -s 512 and then execute your program and see if there is errors or program misbehaves .
Definitely no expert here, but why should i lower my Stack-size from 8196 KB to 512? (ulimit -s is for the "soft"-limit?!)
Oh sorry, I didn't see the ulimit -Ha part from the quote text field. :-[
It seems there is no limits. Please open a terminal in your program directory, execute ulimit -s 512 and then execute your program and see if there is errors or program misbehaves .
Info about on this : https://unix.stackexchange.com/questions/127602/default-stack-size-for-pthreadsThx for the link. Learned something new
Don't let us guess, provide a sample project that shows the problem. ld.so is the dynamic linker. Works when you run your app.The problem seems to be the sqlite-connection-object in context of running the connection in its own thread.
@ThaddyYes. The Sqlite3 component for SqlDb is adapted to use sqlite_open_v2 by default on my request. Target release is 3.2.0 .
By any chance: In trunk, are you using sqlite_open_v2 for InternalConnect?
I‘ve looked through the sourcecode, and found sqlite_open being used, and the docs for sqlite say, in that case sqlite is run with compiletime-options regarding multiple threads.
The default compile-options for distro-binaries is mode 1 (Serialized?), so right now i don‘t have a clue if it‘s my sqlite-lib being in singlethread-mode, or what you mentioned.
I‘m going to setup a small test, if the error occurs in a naked, stripped down, code
You also still have to keep in mind Cyrax remark about lowering the stack size on some platforms.About that: Any pointers how to do that? Still fairly new to everything.
You can also set {$MINSTACKSIZE number} and {$MAXSTACKSIZE number} in your code. The minimum value for {$maxstacksize} is 2048, though, you can't set it to 512, but 2048 should suffice in most cases.You also still have to keep in mind Cyrax remark about lowering the stack size on some platforms.About that: Any pointers how to do that? Still fairly new to everything.
At a guess: there is somewhere in Project-Options a Flag i can set the stacksize....
EDIT. Found it.
The "-Cs"-Option?
Value is what? in Kb?
Like "-Cs 512" is setting Stacksize to 512 Kb?
You also still have to keep in mind Cyrax remark about lowering the stack size on some platforms.About that: Any pointers how to do that? Still fairly new to everything.
At a guess: there is somewhere in Project-Options a Flag i can set the stacksize....
EDIT. Found it.
The "-Cs"-Option?
Value is what? in Kb?
Like "-Cs 512" is setting Stacksize to 512 Kb?
I‘m going to setup a small test, if the error occurs in a naked, stripped down, code
You also still have to keep in mind Cyrax remark about lowering the stack size on some platforms.About that: Any pointers how to do that? Still fairly new to everything.
At a guess: there is somewhere in Project-Options a Flag i can set the stacksize....
EDIT. Found it.
The "-Cs"-Option?
Value is what? in Kb?
Like "-Cs 512" is setting Stacksize to 512 Kb?
It is a parameter you pass to the thread constructor.